diff options
Diffstat (limited to 'stretch-armhf-developer/customization/hooks/03-check_sudoers_for_admin.chroot')
-rwxr-xr-x | stretch-armhf-developer/customization/hooks/03-check_sudoers_for_admin.chroot | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/stretch-armhf-developer/customization/hooks/03-check_sudoers_for_admin.chroot b/stretch-armhf-developer/customization/hooks/03-check_sudoers_for_admin.chroot new file mode 100755 index 0000000..fe86124 --- /dev/null +++ b/stretch-armhf-developer/customization/hooks/03-check_sudoers_for_admin.chroot @@ -0,0 +1,17 @@ +#!/bin/sh + +# check to make sure sudoers file has ref for the sudo group +SUDOEXISTS="$(awk '$1 == "%sudo" { print $1 }' /etc/sudoers)" +if [ -z "$SUDOEXISTS" ]; then + # append sudo entry to sudoers + echo "# Members of the sudo group may gain root privileges" >> /etc/sudoers + echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +fi + +# make sure that NOPASSWD is set for %sudo +# expecially in the case that we didn't add it to /etc/sudoers +# just blow the %sudo line away and force it to be NOPASSWD +sed -i -e ' +/\%sudo/ c \ +%sudo ALL=(ALL) NOPASSWD: ALL +' /etc/sudoers |