XK0-005 · Question #533
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…
The correct answer is B. restorecon -R -v /var/www/html. 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…
Question
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?
Options
- Ased -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
- Brestorecon -R -v /var/www/html
- Csetenforce 0
- Dsetsebool -P httpd_can_network_connect_db on
How the community answered
(33 responses)- A3% (1)
- B82% (27)
- C9% (3)
- D6% (2)
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.
Topics
Community Discussion
No community discussion yet for this question.