Script to add multiple users in ubuntu (Bulk)

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?


Solution 1:

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

vim /tmp/name
mika
mery
etc

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

Solution 2:

Try newusers echo "vivek:myUltraSecretPassword" | sudo newusers