Run the script :

#  for  u  in  $(seq  01  05);  do  echo  “user${u}:user${u}:$(expr 1000 + $u):123:User Info ${u}:/home/user${u}:/bin/bash”;  done  >  user.txt

This script will create a file user.txt in your home folder with the following content :

user1:user1:1001:123:User Info 1:/home/user1:/bin/bash

user2:user2:1002:123:User Info 2:/home/user2:/bin/bash

and so on…

Note:  The 2nd attribute (user1,user2) is the password.

Now, run the command :

#  newusers  user.txt

Now, you can login with new user accounts.

/etc/passwd file format :



a)      Username – It is used when user logs in the machine. It is case sensitive.

b)      Password – An ‘x’ indicates that password is encrypted and stored in /etc/shadow file.

c)       User ID – Each user must be assigned a user ID. UID 0 (zero) is reserved for root.

d)      Group ID – This number identifies the primary group of the user.

e)      User Info – It allows you to add extra information about the users such as user’s full name, phone number, etc.

f)       Home Directory – The absolute path to the directory the user will be in when they log in. Usually /home/username.   All user’s personal files, web pages, mail forwarding, etc. will be stored here.

g)      Shell – User’s shell account. Often set to ‘/bin/bash’ to provide access to the bash shell.

/etc/shadow file format :



a)      Username – Same as in /etc/passwd.

b)      Password – Encrypted password with salt. A blank entry (::) indicates a password is not required to log in and a ‘*’ entry (:*:) indicates the account has been disabled or locked.

  • $id$salt$encrypted“, where “$id” is the hashing algorithm used (On linux, “$1$” stands for MD5, “$2$” is Blowfish, “$5$” is SHA-256 and “$6$” is SHA-512, other Unix may have different values).

c)       The number of days (since January 1, 1970) since the password was last changed.(Unix epoch)

d)      The number of days before password may be changed (0 indicates it may be changed at any time).

e)      The number of days after which password must be changed (99999 indicates user can keep his or her password  unchanged for many, many years).

f)       The number of days before password is to expire, that user is warned that his/her password must be changed.

g)      The number of days after password expiration, that account is disabled.

h)      The number of days (since January 1, 1970) that an account has been disabled.

i)       A reserved field for possible future use.