Prevent running 'vagrant ssh' as root
Resolve possible issues with 'vagrant ssh' when executed as root
This commit is contained in:
parent
a31bf233dc
commit
01e8e22c01
@ -78,7 +78,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Grab first IP or use whatever HOST_IP_FIELD is set to and check that the guest is up
|
# Grab first IP or use whatever HOST_IP_FIELD is set to and check that the guest is up
|
||||||
HOST_IP="$(vagrant ssh -c "hostname -I | cut -d' ' -f${HOST_IP_FIELD:-1}" "${1:-default}" 2>/dev/null)"
|
HOST_IP="$(sudo -u "$SUDO_USER" vagrant ssh -c "hostname -I | cut -d' ' -f${HOST_IP_FIELD:-1}" "${1:-default}" 2>/dev/null)"
|
||||||
if [ -z "$HOST_IP" ]; then
|
if [ -z "$HOST_IP" ]; then
|
||||||
echo "[ERROR]: Failed to find ${1:-default}'s IP"
|
echo "[ERROR]: Failed to find ${1:-default}'s IP"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user