Question 390 of 510
TroubleshootingeasyMultiple ChoiceObjective-mapped

Quick Answer

The correct answer is to use visudo to edit the /etc/sudoers file. This is because the sudoers file defines the rules for which users and groups can execute commands with elevated privileges, and it must be edited exclusively with visudo to prevent syntax errors that could lock out all administrative access. The visudo command locks the file against simultaneous edits and performs a syntax validation before saving, ensuring that a misconfiguration—such as a missing comma or incorrect alias—does not break sudo functionality. On the CompTIA Linux+ XK0-005 exam, this scenario tests your understanding of privilege escalation and secure file editing; a common trap is choosing a direct edit with vim or nano, which is unsafe and can lead to a locked system. Remember the memory tip: “visudo validates, vim voids access”—always use visudo when granting sudo access.

XK0-005 Troubleshooting Practice Question

This XK0-005 practice question tests your understanding of troubleshooting. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

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?

Question 1easymultiple choice
Full question →

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 correct answer is D because 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.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

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.

    Related concept

    Read the scenario before looking for a memorised answer.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates may 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.

Detailed technical explanation

How to think about this question

The sudoers file uses a specific syntax defined in the sudoers man page, where entries can specify users, groups (prefixed with %), and command restrictions. The visudo command locks the file to prevent concurrent edits and validates syntax using a built-in parser; if syntax errors are detected, visudo prompts the user to fix them or abort, preventing a broken sudoers file that could lock out all administrative access. In real-world scenarios, a common mistake is editing /etc/sudoers directly with a text editor like vim, which can lead to a system where no one can run sudo, requiring recovery via single-user mode or a live CD.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A security administrator must allow nursing staff to reach a patient records server while blocking access from the guest Wi-Fi VLAN. After applying an extended ACL, traffic is still blocked from nursing workstations. The ACL was applied outbound instead of inbound on the wrong interface. Questions like this test ACL direction and placement rules.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related XK0-005 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free XK0-005 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this XK0-005 question test?

Troubleshooting — This question tests Troubleshooting — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Use visudo to edit /etc/sudoers — The correct answer is D because 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.

What should I do if I get this XK0-005 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More XK0-005 practice questions

Last reviewed: Jun 25, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This XK0-005 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-005 exam.