/etc/passwd
3 August 2025 (Updated 3 August 2025)
/etc/passwd is a text file on Unix systems where each line represents a single system user account. Unix systems use /etc/passwd to identify and manage users.
Each line has seven colon-separated fields:
username:password:UID:GID:comment:home_directory:shell
Here’s a breakdown of each field:
| Field | Example | Description |
|---|---|---|
| username | sajad | Login name |
| password | x | Placeholder (x means real password is in /etc/shadow) |
| UID | 501 | User ID (unique numeric ID) |
| GID | 20 | Primary Group ID (references /etc/group) |
| comment | Sajad Torkamani | Also called the “GECOS” field (can store full name or other info) |
| home_directory | /Users/sajad | User’s home folder |
| shell | /bin/bash | Login shell used when the user logs in |
Note that macOS doesn’t use /etc/passwd for user management in the same way Linux does. You can use the following command on macOS to get similar info about a user:
dscacheutil -q user -a name <user>
Tagged:
Unix users