nerdexam
GIAC

GSEC · Question #14

The Linux command to make the /etc/shadow file, already owned by root, readable only by root is which of the following?

The correct answer is C. chmod 400/etc/shadow. The chmod 400 command sets file permissions so that only the owner has read access, which is the correct and minimal permission for the sensitive /etc/shadow file.

Linux and Cryptography

Question

The Linux command to make the /etc/shadow file, already owned by root, readable only by root is which of the following?

Options

  • Achmod 444/etc/shadow
  • Bchown root: root/etc/shadow
  • Cchmod 400/etc/shadow
  • Dchown 400 /etc/shadow

How the community answered

(42 responses)
  • A
    7% (3)
  • B
    14% (6)
  • C
    76% (32)
  • D
    2% (1)

Why each option

The chmod 400 command sets file permissions so that only the owner has read access, which is the correct and minimal permission for the sensitive /etc/shadow file.

Achmod 444/etc/shadow

chmod 444 sets read permission for owner, group, AND others, which would allow all users to read the shadow file, defeating its security purpose.

Bchown root: root/etc/shadow

chown root:root changes file ownership but does not modify permissions, so it would not enforce read-only access for root only.

Cchmod 400/etc/shadowCorrect

chmod 400 sets permissions to read-only for the owner (root) and no permissions for group or others (octal 4=read, 0=none, 0=none). Since /etc/shadow already belongs to root, this ensures only root can read the file, protecting hashed passwords from unauthorized access. This is the minimal and correct permission set for this security-sensitive file.

Dchown 400 /etc/shadow

chown is used to change file ownership, not permissions; '400' is not a valid argument for chown and this command would fail or produce an error.

Concept tested: Linux file permissions with chmod for sensitive files

Source: https://man7.org/linux/man-pages/man1/chmod.1.html

Topics

#chmod#file permissions#/etc/shadow#Linux hardening

Community Discussion

No community discussion yet for this question.

Full GSEC Practice