Update adduser.sh to append new users to group
This commit is contained in:
parent
3428dc9843
commit
60b4042681
|
@ -1,8 +1,9 @@
|
||||||
### scripts
|
### scripts
|
||||||
adduser.sh - Script to add new user, run with sudo if you want to configure / allow user to sudo
|
adduser.sh - Script to add new user, run with sudo if you want to configure / allow user to sudo
|
||||||
- `./adduser` - (Print help text)
|
- `./adduser` - (Prints help text)
|
||||||
- `./adduser <name> <userID>` - (Don't need sudo if new user doesn't need it)
|
- `./adduser <name> <userID>` - (Command doesn't need sudo if new user doesn't need sudo)
|
||||||
- `sudo ./adduser <name> <userID>`
|
- `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
|
- 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`
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ printf "\nEnter 1 if $1 should have sudo privileges. Any other value will contin
|
||||||
read choice
|
read choice
|
||||||
if [ $choice -eq 1 ] ; then
|
if [ $choice -eq 1 ] ; then
|
||||||
printf "\nConfiguring sudo for $1...\n"
|
printf "\nConfiguring sudo for $1...\n"
|
||||||
sudo usermod -G sudo $1
|
sudo usermod -aG sudo $1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "\nEnter 1 to set a password for $1, any other value will exit with no password set\n"
|
printf "\nEnter 1 to set a password for $1, any other value will exit with no password set\n"
|
||||||
|
|
Loading…
Reference in New Issue