From ba2569c222af22e48920170e9a002627c7ee9de8 Mon Sep 17 00:00:00 2001 From: Darrell Hamilton Date: Fri, 15 Nov 2013 17:19:35 -0800 Subject: [PATCH] Only give vagrant NOPASSWD ALL --- boxes/build-debian-box.sh | 6 ++---- boxes/build-ubuntu-box.sh | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/boxes/build-debian-box.sh b/boxes/build-debian-box.sh index 4b467bb..d1f7c25 100755 --- a/boxes/build-debian-box.sh +++ b/boxes/build-debian-box.sh @@ -98,10 +98,8 @@ chroot ${ROOTFS} apt-get install sudo -y --force-yes chroot ${ROOTFS} adduser vagrant sudo # Enable passwordless sudo for users under the "sudo" group -cp ${ROOTFS}/etc/sudoers{,.orig} -sed -i -e \ - 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' \ - ${ROOTFS}/etc/sudoers +echo "vagrant 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 8ab5526..73001b9 100755 --- a/boxes/build-ubuntu-box.sh +++ b/boxes/build-ubuntu-box.sh @@ -81,10 +81,8 @@ 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 -cp ${ROOTFS}/etc/sudoers{,.orig} -sed -i -e \ - 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' \ - ${ROOTFS}/etc/sudoers +echo "vagrant ALL=NOPASSWD:ALL" > ${ROOTFS}/etc/sudoers.d/vagrant +chmod 0440 ${ROOTFS}/etc/sudoers.d/vagrant ##################################################################################