Skip to content

Instantly share code, notes, and snippets.

@naviat
Forked from gildas/add-to-sudoers.sh
Created August 1, 2018 16:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naviat/fb437b35434777f86caa772c7bf49e24 to your computer and use it in GitHub Desktop.
Save naviat/fb437b35434777f86caa772c7bf49e24 to your computer and use it in GitHub Desktop.
Add the current user to the sudoers
#!/bin/sh
if [ -z "$1" ] ; then userid=$(whoami); else userid=$1; fi
sudo tee /etc/sudoers.d/${userid} > /dev/null <<EOF
${userid} ALL=(root) NOPASSWD:ALL
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment