Results 1 to 6 of 6

Thread: How to create simultaneously many linux users

Hybrid View

  1. #1
    hansos NNTP User

    Default 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

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: How to create simultaneously many linux users

    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.

  3. #3
    hansos NNTP User

    Default Re: How to create simultaneously many linux users

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

  4. #4
    Join Date
    Jan 2008
    Location
    Kenton, TN USA
    Posts
    1,023

    Default Re: How to create simultaneously many linux users

    Thread moved to Applications
    opensuse.org.help.applications
    Last edited by kastorff; 18-Jul-2008 at 06:24.
    Keith Kastorff

  5. #5
    Join Date
    Jun 2008
    Location
    Omaha, NE
    Posts
    526

    Default Re: How to create simultaneously many linux users

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

  6. #6
    ab@novell.com NNTP User

    Default Re: How to create simultaneously many linux users

    -----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-----

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •