ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 60 - XK0-005 discussion

Report
Export

A Linux systems administrator is setting up a new web server and getting 404 - NOT FOUND errors while trying to access the web server pages from the browser. While working on the diagnosis of this issue, the Linux systems administrator executes the following commands:

Which of the following commands will BEST resolve this issue?

A.
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
Answers
A.
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
B.
restorecon -R -v /var/www/html
Answers
B.
restorecon -R -v /var/www/html
C.
setenforce 0
Answers
C.
setenforce 0
D.
setsebool -P httpd_can_network_connect_db on
Answers
D.
setsebool -P httpd_can_network_connect_db on
Suggested answer: B

Explanation:

The command restorecon -R -v /var/www/html will best resolve the issue. The issue is caused by the incorrect SELinux context of the web server files under the /var/www/html directory. The output of ls -Z /var/www/html shows that the files have the type user_home_t, which is not allowed for web content. The command restorecon restores the default SELinux context of files based on the policy rules. The options -R and -v are used to apply the command recursively and verbosely. This command will change the type of the files to httpd_sys_content_t, which is the correct type for web content.

This will allow the web server to access the files and serve the pages to the browser. The other options are incorrect because they either disable SELinux entirely (sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config or setenforce 0), which is not a good security practice, or enable an unnecessary boolean (setsebool -P httpd_can_network_connect_db on), which is not related to the issue. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 18: Securing Linux Systems, page 535.

asked 02/10/2024
Said Bouzardaoui
38 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first