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