Quiz Entry - updated: 2026.07.14
What information is stored in /etc/passwd and what is its format?
One line per account, seven colon-separated fields: username:x:UID:GID:comment:home:shell — note the password field is just x, a pointer to /etc/shadow.
* The seven fields of an /etc/passwd record. *
The x is the key historical detail: passwords used to live here, but since /etc/passwd must be world-readable (every program needs to map UIDs to names), the hashes were moved to root-only /etc/shadow. The x simply says "look there".
Format (7 colon-separated fields):
username:x:UID:GID:comment:home:shell
Example:
labstudent:x:1004:1004:Lab Student:/home/labstudent:/bin/bash
| Field | Example | Description |
|---|---|---|
| Username | labstudent | Login name |
| Password | x | "x" means password in /etc/shadow |
| UID | 1004 | User ID number |
| GID | 1004 | Primary group ID |
| Comment | Lab Student | Full name or description (GECOS) |
| Home | /home/labstudent | Home directory path |
| Shell | /bin/bash | Login shell |
View users:
cat /etc/passwd
getent passwd username
Note: The password field shows "x" because actual passwords are stored encrypted in /etc/shadow (readable only by root).
Go deeper:
passwd(5) — /etc/passwd file format — the seven colon-separated fields and the
x-points-to-shadow detail.