CompTIA Linux+ (XK0-005) — Question 227
A Linux administrator is creating a new sudo profile for the accounting user. Which of the following should be added by the administrator to the sudo configuration file so that the accounting user can run /opt/acc/report as root?
Answer options
- A. accounting localhost=/opt/acc/report
- B. accounting ALL=/opt/acc/report
- C. %accounting ALL=(ALL) NOPASSWD: /opt/acc/report
- D. accounting /opt/acc/report=(ALL) NOPASSWD: ALL
Correct answer: B
Explanation
The correct answer is B because it grants the accounting user permission to run the specified command on all hosts. Option A restricts the command to localhost, while C and D provide unnecessary complexity and permissions that go beyond the requirement of just running that specific command.