XK0-006 Services and User Management Practice Question
A Linux administrator needs to configure a service to run as a specific user and group, and to restart automatically on failure. The service is managed by systemd. Which directive in the unit file should the administrator use to specify the user and group, and which directive to ensure automatic restart?
⚠ Common exam trap
The trap here is placing User and Group in the [Unit] section and using Restart=always instead of on-failure, or confusing the various restart conditions.
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
✓
User= and Group= in the [Service] section; Restart=on-failure
The correct directives are User= and Group= in the [Service] section, and Restart=on-failure. These set the execution context and restart policy. User and Group must be in [Service] because they affect how the service process runs. Restart=on-failure restarts the service when it exits with a non-zero code or is killed by a signal, covering typical failure conditions.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
User= and Group= in the [Service] section; Restart=on-abort
Why it's wrong here
User and Group are correctly placed, but Restart=on-abort only restarts when the service is terminated by a signal that is not clean. It does not restart on non-zero exit codes, so it does not cover all failure scenarios. Restart=on-failure is the correct choice for general failure restart.
- ✗
ExecStart= with su or sudo; Restart=on-abnormal
Why it's wrong here
Using su or sudo in ExecStart is discouraged because systemd can directly set the user and group. Restart=on-abnormal only restarts on signals or timeouts, not on non-zero exit codes. This does not fully meet the requirement to restart on failure, which includes non-zero exits.
- ✗
User= and Group= in the [Unit] section; Restart=always
Why it's wrong here
User and Group are not valid in the [Unit] section; they belong in [Service]. Restart=always would restart the service even after a clean exit, which is not desired when only failure restart is needed. This option misplaces directives and uses an overly broad restart policy.
- ✓
User= and Group= in the [Service] section; Restart=on-failure
Why this is correct
The User and Group directives in the [Service] section specify the user and group under which the service runs. Restart=on-failure ensures systemd restarts the service if it exits with a non-zero status or is terminated abnormally. This combination meets both requirements.
Go deeper
Related to this question
Learn chapter
File Permissions and Ownership
Key term
Process
In IT service management, a process is a structured set of activities designed to accomplish a specific objective, such as managing incidents or changes, by transforming inputs into defined outputs.
Key term
systemd
systemd is a system and service manager for Linux operating systems that initializes and manages processes, services, and system resources after the kernel boots.
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 →
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.