X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=usr_sbin%2Fmake_chroot_jail;h=083c2d27e6a9338ab7788051a1f28504b327645a;hb=3b7f948896440f41092f14347b17ce114072c569;hp=d14d11240a3bd3767017fb6c098d3aca76712d84;hpb=93921e32a9dc552f1dc2da1d26c40ad698cb9eff;p=grml-scripts.git diff --git a/usr_sbin/make_chroot_jail b/usr_sbin/make_chroot_jail index d14d112..083c2d2 100755 --- a/usr_sbin/make_chroot_jail +++ b/usr_sbin/make_chroot_jail @@ -278,10 +278,17 @@ echo # skip the creation of the new account if [ "$1" != "update" ]; then -# Modifiy /etc/sudoers to enable chroot-ing for users +# Modify sudo config to enable chroot-ing for users, # must be removed by hand if account is deleted -echo "Modifying /etc/sudoers" -echo "$CHROOT_USERNAME ALL=NOPASSWD: `which chroot`, /bin/su - $CHROOT_USERNAME" >> /etc/sudoers +SUDOERS="$CHROOT_USERNAME ALL=NOPASSWD: $(which chroot), /bin/su - $CHROOT_USERNAME" +if [ -d /etc/sudoers.d ]; then + echo "Installing sudoers configuration file /etc/sudoers.d/jail-$CHROOT_USERNAME" + echo "$SUDOERS" > "/etc/sudoers.d/jail-$CHROOT_USERNAME" + chmod 0440 "/etc/sudoers.d/jail-$CHROOT_USERNAME" +else + echo "Modifying /etc/sudoers" + echo "$SUDOERS" >> /etc/sudoers +fi # Define HomeDir for simple referencing HOMEDIR="$JAILPATH/home/$CHROOT_USERNAME"