nerdexam
CompTIA

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.

Troubleshooting

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)
  • A
    2% (1)
  • B
    95% (59)
  • C
    3% (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.

Asudo 755 /etc/passwd

sudo 755 /etc/passwd would set execute permissions for group and others, which is inappropriate and a security risk for /etc/passwd.

Bsudo chmod 644 /ete/passwdCorrect

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.

Csudo chmod 644 /etc/shadow

/etc/shadow stores encrypted password hashes and needs stricter permissions, typically 640 or 000, not 644, and this question is about /etc/passwd.

Dsudo chmod 755 /etc/shadow

/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

#File Permissions#chmod command#/etc/passwd#User Account Management

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice