From 7d1716b82f42b9ef2cb40c612606bbb9de1b4b14 Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Sun, 9 Feb 2014 22:57:11 -0300 Subject: [PATCH] Use sudoers.d in Debian Debian 6.0+ have sudoers.d enabled by default. Use it so that the provisioners (like Chef) don't need to agree on using "sudo" group, or know anything about "vagrant" user if it manages the /etc/sudoers file. --- packer/scripts/debian/sudoers.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packer/scripts/debian/sudoers.sh b/packer/scripts/debian/sudoers.sh index 3fdfb5418..38d767088 100644 --- a/packer/scripts/debian/sudoers.sh +++ b/packer/scripts/debian/sudoers.sh @@ -1,7 +1,9 @@ #!/bin/bash -eux -# Only add the secure path line if it is not already present - Debian 7.1.0 +# Only add the secure path line if it is not already present - Debian 7 # includes it by default. grep -q 'secure_path' /etc/sudoers || sed -i -e '/Defaults\s\+env_reset/a Defaults\tsecure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"' /etc/sudoers -sed -i -e 's/^%sudo.*/%sudo ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers +# Set up password-less sudo for the vagrant user +echo 'vagrant ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/99_vagrant +chmod 440 /etc/sudoers.d/99_vagrant