easyMultiple ChoiceObjective-mapped
XK0-006 Practice Question: A user attempts to run a command using sudo but…
A user attempts to run a command using sudo but receives 'user is not in the sudoers file. This incident will be reported.' Which file should be edited to grant the user sudo access?
⚠ Common exam trap
Many candidates think adding a user to the wheel group (Option B) is sufficient, but without a corresponding entry in the sudoers file (e.g., '%wheel ALL=(ALL) ALL'), the group membership alone does not grant sudo privileges.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use visudo to edit /etc/sudoers
The sudoers file, typically located at /etc/sudoers, controls which users and groups are permitted to run commands with sudo. The visudo command must be used to edit this file safely, as it performs syntax checking to prevent lockouts due to misconfiguration. Directly editing /etc/sudoers with a regular text editor can lead to syntax errors that break sudo functionality.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Edit /etc/passwd directly
Why it's wrong here
Does not control sudo access.
- ✗
Edit /etc/group to add user to the wheel group
Why it's wrong here
If the wheel group is not configured in sudoers, this won't help.
- ✗
Edit /etc/shadow
Why it's wrong here
Contains passwords, not sudo config.
- ✓
Use visudo to edit /etc/sudoers
Why this is correct
The proper way to grant sudo access.
Go deeper
Related to this question
Learn chapter
File Permissions and Ownership
Key term
User
A user is any person, system, or device that interacts with an IT service, resource, or identity system, typically authenticated through credentials and authorized to perform specific actions.
Key term
sudo
sudo is a command-line utility in Unix-like operating systems that allows a permitted user to execute a program as another user, typically the superuser (root), based on security policy settings.
About these practice questions
This XK0-006 question is part of Courseiva's 979-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.