101-400 · Question #449
Which permissions and ownership should the file /etc/passwd have?
The correct answer is B. -rw-r--r--1 rootroot531 Jun 5 22:45 /etc/passwd. See the full explanation below for the reasoning.
Question
Options
- A-rw-------1 rootroot531 Jun 5 22:45 /etc/passwd
- B-rw-r--r--1 rootroot531 Jun 5 22:45 /etc/passwd
- C-rw-r--r--1 11531 Jun 5 22:45 /etc/passwd
- D-rw-------1 11531 Jun 5 22:45 /etc/passwd
How the community answered
(35 responses)- A3% (1)
- B80% (28)
- C11% (4)
- D6% (2)
Community Discussion
6B is the right answer. /etc/passwd needs to be world-readable because every process on the system maps UIDs to usernames, and that includes things like ls -l, ps, and id running as unprivileged users. If you lock it down to root-only like option A or D, those tools break for regular users because they cannot resolve names from numeric IDs. Root gets read-write (the rw- at the front) so it can update entries with tools like usermod or passwd, but everyone else gets read-only (the r-- twice). You can verify this on any healthy Linux box with stat /etc/passwd or ls -l /etc/passwd, and man 5 passwd confirms the expected 644 mode. Option C looks close but has UID 1 as owner instead of root, which is wrong since root must own this file to protect its integrity.
B is the correct answer, and this one trips people up because they assume a file storing user credentials should be locked down tight, but /etc/passwd has to be world-readable so that system utilities and non-privileged processes can resolve usernames from UIDs. The write permission stays root-only (the leading rw- for the owner), while group and others each get read-only (r-- r--), which gives you 644 in octal. That ownership is root root, so options C and D fall off immediately since numeric UID 1 is typically the daemon or bin account, not root. LPI Topic 104.5 covers exactly this kind of permission and ownership reasoning, and it carries a weight of 3 on the 101-400 blueprint, so expect to see two or three scenarios like this on test day. Memory hook: passwd is public, shadow is secret, and that contrast alone tells you 644 for passwd and 640 or 000 for /etc/shadow.
Good question, and I almost second-guessed myself on this one. /etc/passwd has to be world-readable because every user and basically every program on the system needs to look up usernames, UIDs, home directories, and shells, so locking it down to root-only like option A would break logins for everyone. The tricky part for me was B vs C, because C swaps "root root" for "1 1", which looks like it might be pointing at a UID/GID number instead of the actual account name, and while 1 is often the daemon account on some systems, /etc/passwd should be owned by root, not some numbered account. So B is your answer, owner root, group root, permissions 644, readable by all but only writable by root.
B. /etc/passwd is world-readable by design, root-owned, never mode 600.
Solid call, and the exam loves pairing that fact with /etc/shadow, which holds the actual hashed credentials at mode 640 or 000 owned by root:shadow, making that split the whole reason passwd can stay world-readable without leaking secrets.
Okay real talk, option C trips people up because the numeric "1 1" ownership looks like it could be a valid UID/GID pair, but /etc/passwd must be owned by root (named, not numeric) and readable by everyone since programs like ls need to map UIDs to usernames. B is your answer, rw-r--r-- with root root, no shortcuts.