CompTIA Server+ (SK0-005) — Question 113
A user logs in to a Linux server and attempts to run the following command:
sudo emacs /root/file
However, the user gets the following message:
User userid is not allowed to execute ‘emacs’ on this server.
Which of the following would BEST allow the user to find out which commands can be used?
Answer options
- A. visudo | grep userid
- B. sudo -1 -U userid
- C. cat /etc/passwd
- D. userlist | grep userid
Correct answer: B
Explanation
The correct answer is B because the command 'sudo -l -U userid' displays the user's allowed commands under sudo, helping them understand their permissions. Option A, while it checks sudoers for the user, does not directly show allowed commands. Option C shows user information but not sudo privileges, and option D is not a valid command for checking sudo access.