Re: A full detailed add user script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Dwi Suharto wrote:
Anyone here have any sample script, using BASH, for adding user. The script can define:
- home directory
- quota
- create public_html folder
- update shadow password (in replace to manually using passwd particularly to related user)

Thank you.

Dwi Suharto
Rumahweb's TSO
http://www.rumahweb.com

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos
No but it shouldn't take more than 10 minutes to write one. All you would need is to run a script like this:

useradd foo
setquota foo 102000000 102000000 0 0 /home #this is 100GB
mkdir /home/foo/public_html
echo plain_pass | passwd --stdin foo

You can also have the script read command line arguments so you can specify the user name as an argument and read it using $1. Also, you shouldn't edit the shadow file directly, that's what the passwd command is for.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux