CompTIA Linux+ (XK0-005) — Question 206

A Linux user is trying to execute commands with sudo but is receiving the following error:

$ sudo visudo
>>> /etc/sudoers: syntax error near line 28 <<<
sudo: parse error in /etc/sudoers near line 28
sudo: no valid sudoers sources found, quitting

The following output is provided:

# grep root /etc/shadow
root:*LOCK*:14600::::::

Which of the following actions will resolve this issue?

Answer options

Correct answer: B

Explanation

The correct answer is B because booting in single user mode allows you to access the system as the root user without needing sudo, enabling you to safely edit the sudoers file. Option A is incorrect because direct root login is not always possible if the root account is locked. Options C and D would still require sudo privileges, which are not available due to the syntax error.