Courseiva

XK0-006 Services and User Management Practice Question

A Linux administrator needs to grant the user 'alice' the ability to run all commands as root without being prompted for a password, but only from the host 'server1'. Which entry in /etc/sudoers accomplishes this?

⚠ Common exam trap

The trap here is mixing up the host and runas fields, or misplacing the NOPASSWD tag relative to the command list.

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

✓

alice server1=(ALL) NOPASSWD: ALL

The sudoers file uses the format user host=(runas) command. To allow alice to run all commands as root without a password only on server1, the correct entry is 'alice server1=(ALL) NOPASSWD: ALL'. The host field restricts the rule to server1, and NOPASSWD: ALL removes the password requirement for all commands.

Answer analysis

Option-by-option breakdown

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

  • ✗

    alice server1=(root) NOPASSWD: /bin/bash

    Why it's wrong here

    This entry only permits running /bin/bash as root without a password, not all commands. While it provides a shell, it does not grant the ability to run all commands directly via sudo, and the requirement is to run all commands as root.

  • ✓

    alice server1=(ALL) NOPASSWD: ALL

    Why this is correct

    This sudoers entry allows alice to run any command as any user on the host server1 without a password. The host specification 'server1' restricts the rule to that host, and NOPASSWD: ALL removes the password prompt for all commands.

  • ✗

    alice ALL=(server1) NOPASSWD: ALL

    Why it's wrong here

    This entry attempts to specify server1 as the runas user, which is invalid because the runas list must contain user names, not hostnames. The host part is 'ALL', meaning the rule applies on all hosts, which is not the intended restriction.

  • ✗

    alice ALL=(ALL) NOPASSWD: server1

    Why it's wrong here

    This entry specifies 'server1' as a command, which is invalid because commands must be absolute paths. It would allow alice to run a command named 'server1' on all hosts without a password, which is not the intended behavior and likely fails.

About these practice questions

Courseiva writes every XK0-006 question from scratch — 781 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.