sajad torkamani

/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:

FieldExampleDescription
usernamesajadLogin name
passwordxPlaceholder (x means real password is in /etc/shadow)
UID501User ID (unique numeric ID)
GID20Primary Group ID (references /etc/group)
commentSajad TorkamaniAlso called the “GECOS” field (can store full name or other info)
home_directory/Users/sajadUser’s home folder
shell/bin/bashLogin 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