Courseiva
mediumMultiple ChoiceObjective-mapped

XK0-006 Practice Question: A CentOS 7 web server experienced an abrupt power…

A CentOS 7 web server experienced an abrupt power loss. Upon reboot, the httpd service fails to start. The administrator runs `systemctl status httpd` and sees 'Active: failed (Result: exit-code)'. The journal displays 'Permission denied: "/var/www/html/index.html"'. The file `/var/www/html/index.html` has permissions `-rw-r--r--` and is owned by `apache:apache`. SELinux is in enforcing mode. Which action should the administrator take to resolve the issue?

⚠ Common exam trap

Candidates often confuse file permissions (rw-r--r--) with SELinux contexts, or assume ownership changes are needed, when the real issue is a missing or incorrect SELinux label that restorecon fixes.

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

Execute restorecon -R /var/www/html to restore SELinux contexts.

The httpd service fails because SELinux is in enforcing mode and the file /var/www/html/index.html has an incorrect SELinux context, likely httpd_sys_content_t. The restorecon -R /var/www/html command restores the default SELinux security contexts for the directory and its contents, allowing Apache to read the file. This is the standard fix when SELinux contexts are lost or corrupted, such as after a power loss or file restoration.

Answer analysis

Option-by-option breakdown

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

  • Disable SELinux temporarily with setenforce 0.

    Why it's wrong here

    Disabling SELinux reduces security and does not fix the underlying label issue.

  • Change the file ownership to root:root using chown.

    Why it's wrong here

    Changing ownership to root would prevent the apache user from reading the file.

  • Execute restorecon -R /var/www/html to restore SELinux contexts.

    Why this is correct

    Restores default SELinux labels, which may have been corrupted during power loss.

  • Set the SELinux boolean httpd_can_network_connect to on.

    Why it's wrong here

    This boolean controls network connections, not file system access.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

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 →

How Courseiva writes practice questions · Editorial policy

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.