Ubuntu – Script to add multiple users in ubuntu (Bulk)

command line

I need to add 10 users by a script in Ubuntu 12.04.

That could reduces time by adding users manually , and i can apply this script on other
desktop .

Each user will has a specific user and in specific group.

Any idea?

Best Answer

  • Open a terminal and type: vim /tmp/name to create a file and the names of the users: eg:

    vim /tmp/name

    Create User with Home Dir and default shell:

    for i in `cat /tmp/name`; do useradd -m -d /home/$i -s /bin/bash $i; done

    Create password for each user:

    for i in `cat /tmp/name`; do passwd $i; done