CompTIA Server+ SK0-005 Practice Question
A CentOS file server also hosts an internal web application from /var/www/html. A junior administrator recently copied user-supplied files into that directory with the command cp -a /home/upload/*.pdf /var/www/html/
. Immediately afterward, the application began returning HTTP 403 Forbidden when those PDFs are requested. The Apache error log shows "Permission denied," and /var/log/audit/audit.log
contains AVC messages in which httpd_t
is denied read access to objects labeled user_home_t
. No traditional POSIX permissions were changed.
Which action should you take first to restore user access while keeping SELinux protections in place?
Temporarily disable SELinux enforcement with
setenforce 0
, verify access, and re-enable it after testing.Add
Require all granted
to the Apache virtual-host configuration and reload the httpd service.Recursively change ownership of the files to
apache:apache
and set permissions to 755.Run
restorecon -R /var/www/html
to reset the files and directories to their default SELinux contexts.