| |
| Friday, October 21, 2005 |
| Add user shell script |
This is a shell script I use to add a new user to my shell account service. There is no need to make a script to delete a user account because the simple userdel -r username does it just fine.
#!/bin/sh # add a shell user # usage: addshelluser.sh username password # adds the user to the group "shell" # then changes permission so no one has perms to their home folder # and finally copies my rules into their home folder
useradd $1 -g shell if cd /home/$1 then passwd $1 cd .. echo "Changing permissions ..." chmod g-rwx $1 chmod o-rwx $1 echo "Permissions changed." echo "Copying rules ..." cp /home/riscphree/rules /home/$1/rules echo "Files copied." fi
There ya go, simple, yes. But it works nicely when you have to do all that for many accounts. |
posted by riscphree @ 2:22 AM   |
|
|
|
|
|
|