How to Add a New User in Linux

1. How to Add a New User in Linux

To add/create a new user, all you’ve to follow the command ‘useradd‘ or ‘adduser‘ with ‘username’. The ‘username’ is a user login name, that is used by user to login into the system.

Only one user can be added and that username must be unique (different from other username already exists on the system).
For example, to add a new user called ‘itims‘, use the following command.

[[email protected] ~]# useradd itims

When we add a new user in Linux with ‘useradd‘ command it gets created in locked state and to unlock that user account, we need to set a password for that account with ‘passwd‘ command.

[[email protected] ~]# passwd itims
Changing password for user itims.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

Once a new user created, it’s entry automatically added to the ‘/etc/passwd‘ file. The file is used to store users information and the entry should be.


The above entry contains a set of seven colon-separated fields, each field has it’s own meaning. Let’s see what are these fields:
  1.   Username: User login name used to login into system. It should be between 1         to 32 charcters long.
2.   Password: User password (or x character) stored in /etc/shadow file in encrypted format.

3.   User ID (UID): Every user must have a User ID (UID) User Identification Number. By default UID 0 is reserved for root user and UID’s ranging from 1-99 are reserved for other predefined accounts. Further UID’s ranging from 100-999 are reserved for system accounts and groups.

4.   Group ID (GID): The primary Group ID (GID) Group Identification Number stored in /etc/group file.

5.   User Info: This field is optional and allow you to define extra information about the user. For example, user full name. This field is filled by ‘finger’ command.

6.   Home Directory: The absolute location of user’s home directory.

7.   Shell: The absolute location of a user’s shell i.e. /bin/bash.

One thought on “How to Add a New User in Linux

Leave a Reply

Your email address will not be published.

%d bloggers like this: