Skip to content

Instantly share code, notes, and snippets.

@maestrofx
Created December 17, 2015 17:47
Show Gist options
  • Save maestrofx/b9f7be60966cb88fbb52 to your computer and use it in GitHub Desktop.
Save maestrofx/b9f7be60966cb88fbb52 to your computer and use it in GitHub Desktop.
script to add sudoers
#!/bin/bash
# Usage
# $ sudo chmod +x add_sudoer.sh
# $ ./add_sudoer.sh username
#
# add a number of users saved in txt
# $ ./add_sudoer.sh `cat list_of_users.txt`
#
# --> list of users to add separated by space
# --> echo "user1 user2 " >> list_of_users.txt
while [[ -n $1 ]]; do
sudo adduser $1 && sudo usermod -aG sudo $1;
shift
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment