To add/create a new user, all you’ve to follow the command ‘‘ or ‘‘ 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 ‘‘, use the following command.
When we add a new user in Linux with ‘‘ command it gets created in locked state and to unlock that user account, we need to set a password for that account with ‘‘ command.
Once a new user created, it’s entry automatically added to the ‘‘ 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. : User login name used to login into system. It should be between 1 to 32 charcters long.
2. : User password (or x character) stored in /etc/shadow file in encrypted format.
3. : 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. : The primary Group ID (GID) Group Identification Number stored in /etc/group file.
5. : 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. : The absolute location of user’s home directory.
7. : The absolute location of a user’s shell i.e. /bin/bash.