The ‘/etc/passwd‘ file in Linux contains user and user related information.
An entry in /etc/passwd file contains seven entries/fields and looks like:
a → Username
username is between 1 and 32 characters in length.
b → Password
an ‘x‘ character indicates that encrypted password is stored in /etc/shadow file.
c → User ID (UID)
Each user is assigned a user ID (UID). UID 0 (zero) is reserved for root and UIDs 1-99 are reserved for other predefined accounts. UID 100-999 are reserved by system for administrative and system accounts/groups. Therefore, other users except the root has UIDs greater than 1000.
d → Group ID (GID)
The primary group ID (stored in /etc/group file)
e → User Group Info
The comment field. It allow us to add extra information about the users such as user’s full name, phone number etc.
f → Home Directory
The absolute path to the directory the user will be assigned when they log in. If this directory does not exists then the users directory becomes /
g → Shell / Command
The absolute path of a command or shell. The shell that the particular user will be assigned upon logon. E.g. /bin/bash; /bin/sh; /usr/sbin/nologin; /bin/false; etc.