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
  • Save naviat/fb437b35434777f86caa772c7bf49e24 to your computer and use it in GitHub Desktop.
Save naviat/fb437b35434777f86caa772c7bf49e24 to your computer and use it in GitHub Desktop.

Revisions

  1. @gildas gildas renamed this gist Mar 26, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @gildas gildas created this gist Mar 26, 2018.
    6 changes: 6 additions & 0 deletions add_to_sudo.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    #!/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