Skip to content

Instantly share code, notes, and snippets.

@calvinchengx
Created April 24, 2012 07:28
Show Gist options
  • Save calvinchengx/2477468 to your computer and use it in GitHub Desktop.
Save calvinchengx/2477468 to your computer and use it in GitHub Desktop.
if [ -e /etc/sudoers.tmp -o "$(pidof visudo)" ]; then
echo $(pidof visudo)
echo "/etc/sudoers busy, try again later"
exit 1
fi
cp -p /etc/sudoers /etc/sudoers.bak
cp -p /etc/sudoers /etc/sudoers.tmp
line="%wheel ALL=(ALL) ALL"
sed -i "/${line}/ s/# *//" /etc/sudoers.tmp
mv /etc/sudoers.tmp /etc/sudoers
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment