Skip to content

Instantly share code, notes, and snippets.

@otzoran
Last active December 28, 2015 03:59
Show Gist options
  • Save otzoran/7439195 to your computer and use it in GitHub Desktop.
Save otzoran/7439195 to your computer and use it in GitHub Desktop.
sudo nopass
sudo -i
if [[ -d /etc/sudoers.d ]]; then
echo "ori ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/ori
chmod 440 !$
chown root:root !$ #match the owner && perms of README
elif [[ -e /etc/sudoers ]]; then
echo "ori ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
else
echo "Failed to add ori to sudoers"
fi
# stay in this TTY as root
visudo -c
# expect: /etc/sudoers: parsed OK
# if not, MUST fix it (risk: unable to sudo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment