XK0-006 Security Practice Question
A security audit reveals that a service is running with an incorrect SELinux context. Which two commands can be used to relabel the file or directory to the correct context? (Choose TWO.)
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
✓
restorecon -R /path/to/file
restorecon restores default context based on policy, and chcon can set a specific context manually.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
setenforce 0
Why it's wrong here
Disables enforcement, does not change context.
- ✓
restorecon -R /path/to/file
Why this is correct
Restores default SELinux context.
- ✓
chcon -t httpd_sys_content_t /path/to/file
Why this is correct
Manually sets the context type.
- ✗
fixfiles relabel
Why it's wrong here
Relabels entire filesystem, not targeted.
- ✗
ls -Z
Why it's wrong here
Displays context, does not change it.
Go deeper
Related to this question
Learn chapter
File Permissions and Ownership
Key term
Policy
A policy is a set of rules or guidelines that defines how an organization manages, secures, and operates its IT systems and services.
Key term
Service
A service is a software component or system that performs a specific function and is available to be used by other programs or users over a network.
About these practice questions
Courseiva writes every XK0-006 question from scratch — 979 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 →
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.