Courseiva
Security →easyMultiple Choice

XK0-006 Security Practice Question

A Linux administrator needs to grant a user named 'bob' the ability to run the /usr/bin/systemctl command as root without being prompted for a password. Which entry should be added to the sudoers file to accomplish this?

⚠ Common exam trap

The trap here is forgetting that sudoers requires absolute paths for commands and misplacing the NOPASSWD tag, leading to a non-functional or overly permissive rule.

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

✓

bob ALL=(ALL) NOPASSWD: /usr/bin/systemctl

The sudoers entry must specify the user, hosts, target user, the NOPASSWD tag, and the full path to the command. The line 'bob ALL=(ALL) NOPASSWD: /usr/bin/systemctl' grants exactly the intended permission without a password, while other options either require a password, lack the full path, or grant excessive privileges. Always use visudo to edit sudoers to avoid syntax errors.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    bob ALL=(ALL) NOPASSWD: ALL

    Why it's wrong here

    This entry grants bob passwordless access to all commands, which is far broader than required. It gives full root privileges without a password, violating the principle of least privilege. The task is to allow only systemctl, so this over-permissive entry is incorrect.

  • ✗

    bob ALL=(root) NOPASSWD: systemctl

    Why it's wrong here

    While this entry uses NOPASSWD, it specifies the command as 'systemctl' without the full path. Sudoers requires absolute paths for commands to prevent path manipulation attacks. Using a relative command name will cause a syntax error or may not work as intended. The full path /usr/bin/systemctl is necessary.

  • ✗

    bob ALL=(ALL) PASSWD: /usr/bin/systemctl

    Why it's wrong here

    The PASSWD tag explicitly requires bob to enter his password when running systemctl, which contradicts the requirement for no password prompt. Additionally, PASSWD is the default behavior, so this entry would not change anything. The correct tag to suppress the password prompt is NOPASSWD.

  • ✓

    bob ALL=(ALL) NOPASSWD: /usr/bin/systemctl

    Why this is correct

    This sudoers entry allows user bob to run /usr/bin/systemctl as any user (including root) without a password prompt. The NOPASSWD tag disables the password requirement, and the command is specified with its full path as required by sudoers syntax. This precisely meets the requirement to grant passwordless systemctl execution.

About these practice questions

One of 781 original XK0-006 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CompTIA exam blueprint

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.