[Techtalk] script for adding users
Devdas Bhagat
devdas at dvb.homelinux.org
Sun May 9 11:17:13 EST 2004
On 09/05/04 10:07 +1000, wendy wrote:
> Anybody know of an easy way to add 100 users to linux? I was thinking
> in terms of maybe a bash script calling on a spreadsheet file with
> username and password.
>From man 8 newusers
newusers - update and create new users in batch
newusers reads a file of user name and cleartext password
pairs and uses this information to update a group of
existing users or to create new users. Each line is in
the same format as the standard password file (see
passwd(5)) with the following exceptions.
Alternatively, you could run a loop over your source file and call
useradd and then chpasswd to set passwords.
If the input is of the form
username:password
for i in `cut -f1 -d: input_file`
do
useradd ${i}
done
chpasswd input_file
Devdas Bhagat
More information about the Techtalk
mailing list