Linux User Account command
Linux User Account command
--------------------------------------------
When we run ‘useradd‘ command in Linux terminal, it performs following major things:
It edits /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow files for the newly created User account.
<OR>
Note : 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.
nanda:x:504:504:nanda:/home/nanda:/bin/bash
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:
Username : User login name used to login into system. It should be between 1 to 32 charcters long.
Password : User password (or x character) stored in /etc/shadow file in encrypted format.
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.
Group ID (GID) : The primary Group ID (GID) Group Identification Number stored in /etc/group file.
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.
lauser:x:505:505::/opt/la-home:/bin/bash
mgmg:x:999:999::/home/mgmg:/bin/bash
susu:x:1000:500::/home/susu:/bin/bash
Note : Set a account password expiry date i.e. 45 days on a user ‘user02’ using ‘-e‘ and ‘-f‘ options.