Problem Statement
What information is stored in /etc/passwd file?
Explanation
The /etc/passwd file contains user account information in colon-separated fields: username:x:UID:GID:comment:home_directory:shell. Example: john:x:1001:1001:John Doe:/home/john:/bin/bash. The 'x' in password field indicates password is in /etc/shadow (shadowed passwords for security).
UID (User ID) is numerical identifier for the user, with 0 for root, 1-999 for system accounts, and 1000+ for regular users (varies by distribution). GID (Group ID) is the primary group. Comment field typically contains full name. Home directory is the user's personal space, and shell is the login shell (e.g., /bin/bash, /bin/sh, /sbin/nologin for accounts that shouldn't login).
The /etc/passwd file is world-readable because many programs need to look up username-to-UID mappings. However, actual passwords are stored in /etc/shadow which is only readable by root. Understanding /etc/passwd structure is essential for user management, troubleshooting login issues, and scripting user administration tasks.
