XK0-006 Security Practice Question
An administrator wants to audit all attempts to access the file /etc/shadow. Which auditctl command should be used?
⚠ Common exam trap
The trap is that candidates may think the `-a always,exit` syntax is always required, but the `-w` watch syntax with `-p rwxa` is a valid and simpler way to audit all access attempts. Some may also incorrectly believe that reads should not be logged, but the question explicitly asks for 'all attempts to access'.
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
✓
auditctl -w /etc/shadow -p rwxa -k shadow
`auditctl -w /etc/shadow -p rwxa -k shadow` sets a watch on the file for all access types: read (r), write (w), execute (x), and attribute change (a). This captures all attempts to access the file, including reads, which matches the requirement. Option C uses `-F perm=wa`, which only logs write and attribute changes, excluding reads. Option A has invalid syntax (`-A` instead of `-a`). Option D uses `ausearch`, which is for searching audit logs, not setting rules.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
auditctl -A exit,always -F path=/etc/shadow -k shadow
Why it's wrong here
Incorrect because `-A exit,always` uses invalid flag order; the correct syntax is `-a always,exit`.
- ✓
auditctl -w /etc/shadow -p rwxa -k shadow
Why this is correct
Correct because `-w /etc/shadow -p rwxa` watches the file for all access types (read, write, execute, attribute change), auditing every attempt to access the file.
- ✗
auditctl -a always,exit -F path=/etc/shadow -F perm=wa -k shadow
Why it's wrong here
Incorrect because `-F perm=wa` only monitors write and attribute changes, not reads or executes. This does not audit all attempts to access.
- ✗
ausearch -w /etc/shadow
Why it's wrong here
Incorrect because `ausearch` is a tool for querying audit logs, not for setting audit rules; the correct command is `auditctl`.
Go deeper
Related to this question
About these practice questions
This XK0-006 question is part of Courseiva's 979-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 by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.