The /etc/passwd file is a text file that contains important information about each user in Linux Operating Systems.
Some of this info, is username, UID, GID, shell, home directory, and some other.
The file is named as originally it also contained the data used to verify passwords. However, on modern Unix systems the security-sensitive password information is instead often stored in a different file using shadow passwords.
Every user can read it, but only root can write it, unless using sudo permissions.
The fields are separated by “:” semi colons.
And a description for those fields is:
- username / logname The first field is the user name, i.e. the string a user would type in when logging into the operating system: the logname. Each record in the file must have a unique user name field.
- Password The second field stores information used to validate a user's password; however in most modern uses this field is usually set to "x" (or some other indicator) with the actual password information being stored in a separate shadow password file. Setting this field to an asterisk "*" is the typical way to deactivate an account to prevent it being used.
- UID The third field is the user identifier, the number that the operating system uses for internal purposes. It does not have to be unique.
- GID The fourth field is the group identifier. This number identifies the primary group of the user; all files that are created by this user will initially belong to this group.
- User info The fifth field, called the Gecos field, is commentary that describes the person or account. Typically, this is a set of comma-separated values including the user's full name and contact details.
- Home Directory The sixth field is the path to the user's home directory.
- Shell path The seventh field is the shell program that is started every time the user logs into the system, here you use /bin/false to avoid that user to log into the system.