Create Linux user accounts in bulk


creating 1 or 2 new users on your system is a fairly simple task. But when you need to create 50 or 100 accounts on a system, creating it one by one by hand will surely annoy even the most patient sysadmin.


First, create a plain text file that contains all the informations required in a format of standard /etc/passwd file. For example, create a text file newuser.txt

[root@foxbat scripts] vi /root/newuser.txt

that contains:


“ambon” is the account name, “afd43” is the new password for the account, “636” refers to the account UID & GID. I skipped on the user info and leave it as blank. Next,  the “/home/ambon” is the path to the home directory of that particular account, and “/bin/bash is the path to the account shell. Please note that since the password on this plain text is not encrypted, make sure that root and only root is the only user that has access to this file. You can chmod 600 this file to prevent access from another account.

Next, create the accounts by simply doing:

[root@foxbat scripts] newusers /root/newuser.txt

..And we’re done!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s