XK0-006 Services and User Management Practice Question
A junior Linux administrator needs to run a long-running backup script as the user 'backupuser' but currently has an active SSH session as 'adminuser'. The script should continue running even if the SSH session disconnects, and no output should be sent to the terminal. Which command should the administrator use?
⚠ Common exam trap
The trap here is assuming that simply backgrounding a process with & is enough to survive an SSH session ending, when in fact SIGHUP will still be sent without nohup or disown.
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
✓
sudo -u backupuser nohup /usr/local/bin/backup.sh > /dev/null 2>&1 &
The correct command combines sudo -u to run as backupuser, nohup to ignore hangup signals, and output redirection to /dev/null, with & to background it. This ensures the backup script continues after SSH disconnection and produces no terminal output, meeting both requirements precisely.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
su backupuser -c '/usr/local/bin/backup.sh' &
Why it's wrong here
su backupuser -c runs the script as backupuser, but without nohup or disown, the process may receive SIGHUP when the SSH session ends. The ampersand only backgrounds it in the current shell; it does not protect against hangup. This fails the requirement to survive disconnection.
- ✗
screen -dmS backup sudo -u backupuser /usr/local/bin/backup.sh
Why it's wrong here
screen -dmS starts a detached screen session and runs the command inside it. While screen can keep processes alive, it requires screen to be installed and adds unnecessary complexity. The command also does not redirect output; screen captures it, but the requirement was no terminal output. This is overkill and not the most direct solution.
- ✗
at now + 0 minutes <<< 'sudo -u backupuser /usr/local/bin/backup.sh'
Why it's wrong here
at schedules a job to run once at a specific time, but it does not run immediately and may not be installed or enabled. It also runs in a limited environment and does not guarantee no terminal output. This approach is unsuitable for an immediate, detached execution.
- ✓
sudo -u backupuser nohup /usr/local/bin/backup.sh > /dev/null 2>&1 &
Why this is correct
This command uses sudo -u to switch to backupuser, nohup to ignore SIGHUP, and redirects output to /dev/null. The ampersand backgrounds the process, ensuring it survives SSH disconnection. This is the correct approach for running a script as another user detached from the terminal.
Go deeper
Related to this question
Learn chapter
Installing Linux and Package Management
Key term
Output
In IT service management, output is the result or deliverable produced by a process, system, or component, such as data, reports, or services delivered to a customer.
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.
About these practice questions
This XK0-006 question is part of Courseiva's 781-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 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.