A malicious script is suspected to have changed permissions on critical system files. The administrator needs to restore the /etc/passwd file to its default permissions, which are 644. The file is currently 777. Which command will set the correct permissions?
Trap 1: chmod 600 /etc/passwd
This would make the file only readable by root, which would break system tools that need to read the file.
Trap 2: chmod 755 /etc/passwd
This adds execute permission, which is unnecessary and a security risk for a text file.
Trap 3: chmod 444 /etc/passwd
This makes the file read-only for everyone, preventing root from writing to it, which is not the default.
- A
chmod 644 /etc/passwd
This sets owner read/write, group read, others read, which is the correct default for /etc/passwd.
- B
chmod 600 /etc/passwd
Why wrong: This would make the file only readable by root, which would break system tools that need to read the file.
- C
chmod 755 /etc/passwd
Why wrong: This adds execute permission, which is unnecessary and a security risk for a text file.
- D
chmod 444 /etc/passwd
Why wrong: This makes the file read-only for everyone, preventing root from writing to it, which is not the default.