Security

After content was moved into /srv/site, Apache on an enforcing RHEL-family server returns 403 errors. ls -Z shows the files labeled default_t. The correct label, httpd_sys_content_t, must be applied in a way that survives a full filesystem relabel. Which action meets this requirement?

Show the answer

Correct answerC. Run semanage fcontext -a -t httpd_sys_content_t "/srv/site(/.*)?", then restorecon -Rv /srv/site

semanage fcontext records a persistent file-context rule, and restorecon applies it to the existing files, so the label survives a relabel. chcon changes only the current label, and a relabel resets it to the policy default.