[Ilugc] adding multiple user accounts with password

  • From: tom@xxxxxxxxxxxx (Tom Jose Tharayil)
  • Date: Mon Jul 12 12:40:36 2004


Sridhar R wrote:

I want to add enourmous amount of users with specified passwords
automatically with script.  But the problem is `passwd` command
doesn't accept passwords from non-stdin stream and `adduser` command
requires encrypte version of password if at all passed is needed to be
given.

$ useradd foo -p `openssl passwd -1 bar`

Adding user 'foo' with password 'bar'

and for adding multiple users (or an enormously large amount of them)
for i in `seq 1 100`
do
useradd foo$i -p `openssl passwd -1 bar`
done

would add users foo1 foo2 and so on

HTH



-- 
Best Regards
Tom Jose Tharayil
tom@xxxxxxxxxxxx


Other related posts: