Users are accounts that can be used to login into a system. Each user is identified by a unique identification number or UID by the system. All the information of users in a system are stored in /etc/passwd file. The hashed passwords for users are stored in /etc/shadow file.
Users can be divided into two categories on the basis of the level of access:
- Superuser/root/administrator : Access to all the files on the system.
- Normal users : Limited access.
When a new user is created, by default system takes following actions:
- Assigns UID to the user.
- Creates a home directory
/home/. - Sets the default shell of the user to be
/bin/sh. - Creates a private user group, named after the username itself.
- Contents of
/etc/skelare copied to the home directory of the new user. - .bashrc, .bash_profile and .bash_logout are copied to the home directory of new user.These files provide environment variables for this user’s session.
Description of contents of /etc/passwd File
This file is readable by any user but only root as read and write permissions for it. This file consists of the following colon separated information about users in a system:
- Username field
- Password field
- An `x` in this field denotes that the encrypted password is stored in the /etc/shadow file.
- The user ID number (UID)
- User’s group ID number (GID)
- Additional information field such as the full name of the user or comment (GECOS)
- Absolute path of user’s home directory
- Login shell of the user
Syntax:
[username]:[password]:[UID]:[GID]:[GECOS]:[home_dir]:[shell_path]
Example:

Description of contents of the /etc/shadow File
This file is readable and writable by only by root user. This file consists of the following colon separated information about password of users in a system:
- User name field
- Password field
- Contains an encrypted password.
- A blank entry, {:: }, indicates that a password is not required to login into that user’s account.
- An asterisk, {:*:}, indicates the account has been disabled.
- Last Password Change
- This field denotes the number of days since the date of last password change counted since UNIX time (1-Jan-1970).
- The minimum number of days after which the user can change his password.
- Password validity
- Denotes the number of days after which the password will expire.
- Warning period
- Denotes the number of days before the password expiry date, from which the user will start receiving warning notification for password change.
- Account validity
- Denotes the number of days after which the account will be disabled, once the password is expired.
- Account disability
- This field denotes the number of days since which the account had been disabled counted from UNIX time (1-Jan-1970).
Syntax:
[username]:[enc_pwd]:[last_pwd_change]:[pwd_validity]:[warn_date]:[acc_validity]:[acc_disablity]
Example:

Recommended Posts:
- Groups in Linux System Administration
- What is Linux System Administration?
- Beginner's Guide to Linux System Administration
- users command in Linux with Examples
- How to Access All Users in Linux Using Different Commands?
- Linux Virtualization : Linux Containers (lxc)
- Difference Between Arch Linux and Kali Linux
- dup() and dup2() Linux system call
- SAR command in Linux to monitor system performance
- proc file system in Linux
- Linux Operating System | CLI (Command Line Interface) and GUI (Graphic User Interface)
- Introduction to Linux Operating System
- Getting System and Process Information Using C Programming and Shell in Linux
- Basic System Controls with Terminal in Linux
- Introduction to Graphical User Interface of RedHat Linux Operating System
- How to Setup VPN on Ubuntu Linux System for IP Spoofing Using windscribe?
- How to find time taken by a command/program on Linux Shell?
- Terminal Mail and Linux Security Mail
- Linux Virtualization - Chroot Jail
- Linux Kernel Module Programming: Hello World Program
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

