Troubleshooting

After moving site files with mv from /home/dev/site into /var/www/html on a RHEL server, httpd returns 403 Forbidden. The files are mode 0644 and readable by the apache user, and ls -Z shows the user_home_t type on them. ausearch -m avc reports denials for httpd. What is the BEST fix?

Show the answer

Correct answerC. Restore the default file contexts with restorecon -Rv /var/www/html, then retest

mv keeps the source SELinux context, so the files still carry user_home_t, which httpd is not allowed to read. restorecon -Rv /var/www/html relabels them to the policy default (httpd_sys_content_t). Changing mode bits does not help because the denial comes from SELinux, not discretionary permissions. The homedirs boolean only applies to content served from home directories.