Commit 0c8878bd authored by Kirk Webb's avatar Kirk Webb
Browse files

Updated the fixsudo script to just replace the sudoers file completely.

This is much more robust than the old method.
parent b1af269e
#!/bin/sh
cat >/tmp/edscript <<EOF
/^emulab_/s/ALL[ \t]*$/NOPASSWD: ALL/
w
q
TMPSUDOERS=/tmp/sudoers
ME=`whoami`
rm -f $TMPSUDOERS
cat > $TMPSUDOERS <<EOF
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification
# User alias specification
# Cmnd alias specification
# Defaults specification
# User privilege specification
root ALL=(ALL) ALL
$ME ALL=(ALL) NOPASSWD: ALL
%root ALL=(ALL) NOPASSWD: ALL
EOF
su -c "ed /etc/sudoers < /tmp/edscript"
su -c "install -c -m 440 $TMPSUDOERS /etc/sudoers"
exit $?
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment