XK0-005 · Question #804
A systems administrator has changed the permissions on the /etc/passwd file. When a user attempts to log in, the following is displayed on the command prompt: The following output is provided: Which…
The correct answer is B. sudo chmod 644 /ete/passwd. The /etc/passwd file typically requires 644 permissions (rw-r--r--) to allow all users to read it while only root can write, enabling proper user authentication.
Question
A systems administrator has changed the permissions on the /etc/passwd file. When a user attempts to log in, the following is displayed on the command prompt:
The following output is provided:
Which of the following commands will fix the file permissions?
Options
- Asudo 755 /etc/passwd
- Bsudo chmod 644 /ete/passwd
- Csudo chmod 644 /etc/shadow
- Dsudo chmod 755 /etc/shadow
How the community answered
(62 responses)- A2% (1)
- B95% (59)
- C3% (2)
Why each option
The /etc/passwd file typically requires 644 permissions (rw-r--r--) to allow all users to read it while only root can write, enabling proper user authentication.
sudo 755 /etc/passwd would set execute permissions for group and others, which is inappropriate and a security risk for /etc/passwd.
The /etc/passwd file stores user account information and is world-readable but only writable by root. Standard permissions for /etc/passwd are 644, meaning read/write for the owner (root), and read-only for the group and others, which the sudo chmod 644 /etc/passwd command correctly restores.
/etc/shadow stores encrypted password hashes and needs stricter permissions, typically 640 or 000, not 644, and this question is about /etc/passwd.
/etc/shadow needs very restrictive permissions like 640 or 000; 755 would be a severe security vulnerability for this file.
Concept tested: Linux file permissions for /etc/passwd
Source: https://man7.org/linux/manpages/man5/passwd.5.html
Topics
Community Discussion
No community discussion yet for this question.