Update adduser.sh to append new users to group

This commit is contained in:
Shaun Reed 2020-05-27 14:17:40 +00:00
parent 3428dc9843
commit 60b4042681
2 changed files with 5 additions and 4 deletions

View File

@ -1,8 +1,9 @@
### scripts
adduser.sh - Script to add new user, run with sudo if you want to configure / allow user to sudo
- `./adduser` - (Print help text)
- `./adduser <name> <userID>` - (Don't need sudo if new user doesn't need it)
- `./adduser` - (Prints help text)
- `./adduser <name> <userID>` - (Command doesn't need sudo if new user doesn't need sudo)
- `sudo ./adduser <name> <userID>`
- `sudo ./adduser jeff 1005` - (Create jeff user and assign userID to 1005)
- `sudo ./adduser jeff 1005` - (Creates jeff user and assign userID to 1005)
- Follow prompts to configure password / sudo depending on needs of new user
- After the user is created, append them to any needed groups with `sudo usermod -aG groupname username`

View File

@ -19,7 +19,7 @@ printf "\nEnter 1 if $1 should have sudo privileges. Any other value will contin
read choice
if [ $choice -eq 1 ] ; then
printf "\nConfiguring sudo for $1...\n"
sudo usermod -G sudo $1
sudo usermod -aG sudo $1
fi
printf "\nEnter 1 to set a password for $1, any other value will exit with no password set\n"