Courseiva

XK0-006 Automation, Orchestration, and Scripting Practice Question

A Linux administrator needs a cron job that runs /usr/local/bin/collect.sh at 02:30 every Monday, Wednesday, and Friday. The job must be added for the root user without editing the global /etc/crontab file. Which command should the administrator run to open the correct crontab for editing?

⚠ Common exam trap

The trap here is assuming that crontab -e always edits root's table, when it actually targets whichever user invokes it.

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

✓

crontab -u root -e

The crontab command with the -u option edits the named user's personal crontab, so crontab -u root -e reliably opens root's schedule for modification from any account with the needed privilege. The schedule line 30 2 * * 1,3,5 then executes collect.sh at 02:30 on Monday, Wednesday, and Friday, fulfilling the requirement without touching /etc/crontab.

Answer analysis

Option-by-option breakdown

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

  • ✗

    crontab -l -u root

    Why it's wrong here

    The -l flag lists the contents of the specified user's crontab to standard output; it does not open an editor or modify anything. Running it would show existing root jobs but leave the new collect.sh entry unadded, so the automation would never be scheduled. It answers a read-only question rather than the editing task.

  • ✗

    systemctl edit cron

    Why it's wrong here

    This command creates a systemd drop-in override for the cron service unit, which modifies how the daemon starts, not the schedule of individual jobs. No crontab entry for collect.sh is created, so the script would never run on the desired days. It targets service configuration rather than job scheduling.

  • ✓

    crontab -u root -e

    Why this is correct

    The -u flag selects the user whose crontab is being edited, so this command always opens root's personal crontab regardless of which account is currently logged in. Entries placed there are executed as root, and the schedule field can specify 30 2 * * 1,3,5 to meet the Monday, Wednesday, and Friday requirement.

  • ✗

    crontab -e

    Why it's wrong here

    When run as root, crontab -e does edit root's personal crontab, but the scenario asks for a command that unambiguously targets the root user's crontab. The plain form depends on the invoking user's identity, so on a shared administrative account it may edit the wrong table. A user-specific flag is the precise answer here.

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 →

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.