How to create simultaneously many linux users

Usually, I create linux user like this:

useradd -d /home/user1 -m user1

passwd user1

Now I want create 100 users simultaneously with different password.
Do you know how to do it ? (easily)
Thank you

You can give useradd the initial password too, but it must be the crypted form, not the plaintext form, see the man page for the -p option. I don’t know how you are generating the initial passwords, are you making something up and telling it to the user by some other means? If so it’s easy to run useradd in a loop for this.

BTW you don’t need -d if the home directory is always /home/$user. But you might want to add the -m option to copy some skeleton files into the home directory.

OK. If you want, move my question in another place.
Thank you

Thread moved to Applications
opensuse.org.help.applications

A bash script would be the easiest way to add 100 users, but what do you want for their names?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can also set passwords with the ‘passwd’ command using the --stdin
switch:

echo <passwordForUser> | passwd --stdin <someUser>

So yeah, a bash script looping through things. If you want different
passwords for each user that’s fine too but you have to specify them
somehow… if it’s just ‘password0’ ‘password1’ ‘password2’ then that’s
easy but if it’s something specific to each you’ll need to pull those
from a file. Again, a simple script.

Good luck.

enderandrew wrote:
| A bash script would be the easiest way to add 100 users, but what do you
| want for their names?
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIgKjc3s42bA80+9kRAhrDAJ9R6cZyIeXU4/5QP5yz5O+0fhridwCfZCY2
kcqqs2lsPMn/TJpixJUusdY=
=DMpp
-----END PGP SIGNATURE-----