From 774e8175eb259f085db49748c9395c5d84f9610f Mon Sep 17 00:00:00 2001 From: Darrell Hamilton Date: Fri, 15 Nov 2013 17:27:25 -0800 Subject: [PATCH] Complete NOPASSWD for vagrant Previously, vagrant could not do everything with passwordless sudo. Eg. `sudo -u other-user ls` would ask for a sudo password, causing tools like ansible to hang when trying to execute commands as another user. --- boxes/build-debian-box.sh | 2 +- boxes/build-ubuntu-box.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/boxes/build-debian-box.sh b/boxes/build-debian-box.sh index d1f7c25..d020891 100755 --- a/boxes/build-debian-box.sh +++ b/boxes/build-debian-box.sh @@ -98,7 +98,7 @@ chroot ${ROOTFS} apt-get install sudo -y --force-yes chroot ${ROOTFS} adduser vagrant sudo # Enable passwordless sudo for users under the "sudo" group -echo "vagrant ALL=NOPASSWD:ALL" > ${ROOTFS}/etc/sudoers.d/vagrant +echo "vagrant ALL=(ALL) NOPASSWD:ALL" > ${ROOTFS}/etc/sudoers.d/vagrant chmod 0440 ${ROOTFS}/etc/sudoers.d/vagrant diff --git a/boxes/build-ubuntu-box.sh b/boxes/build-ubuntu-box.sh index 73001b9..5ffa27e 100755 --- a/boxes/build-ubuntu-box.sh +++ b/boxes/build-ubuntu-box.sh @@ -81,7 +81,7 @@ echo $VAGRANT_KEY > ${ROOTFS}/home/vagrant/.ssh/authorized_keys chroot ${ROOTFS} chown -R vagrant: /home/vagrant/.ssh # Enable passwordless sudo for users under the "sudo" group -echo "vagrant ALL=NOPASSWD:ALL" > ${ROOTFS}/etc/sudoers.d/vagrant +echo "vagrant ALL=(ALL) NOPASSWD:ALL" > ${ROOTFS}/etc/sudoers.d/vagrant chmod 0440 ${ROOTFS}/etc/sudoers.d/vagrant