This is a small “how-to” on adding users in Linux. As Linux is multi-user supporting operating system, we can add multiple users. Linux administrators/superuser can create new user accounts in Linux. This can be accomplished by executing adduser command from terminal. This command will create user accounts with normal privilegs and default settings. The default settings such as home directories, type of the shell, UID and GID as well are taken from /etc/default/useradd file. Only root user can execute this command. If a normal user want to create accounts in the system he should be granted sudo access for useradd command.

Step 1: Add user account with following command. This will create a user in the machine and edit /etc/passowd file with details.

adduser user-name


adduser surendra

Note 1: There is one more command useradd which will work similar to adduser command. When an user is created the files such as /etc/passwd, /etc/group are edited with new user details.

Note 2: When an user is created the /etc/skel, /etc/useradd/defaults files are used to crate common user properties.

Step 2: Set password for this user so that he can login to the machine. If this step is missed user can not login to this machine.

passwd username


passwd surendra

Note 3: Once we create password, a password hash and user details are created in /etc/shadow file.

Step 3: Check if the user account is created successfully or not using below grep or id command.

grep surendra /etc/passwd



or use id command to see more details.

id surendra


uid=1000(surendra) gid=1000(surendra) groups=1000(surendra),126(admin),1001(libvirtd)

This command should show you a line contain about user: surendra details. From the above output, we can say user  and group ID is assigned with 1000, and this user surendra is member of admin, libvirtd groups as well.

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.