Signal9Signal9 — home
online
back to labs

SELinux: Reset a File to Its Default Context (concept check)

MediumRHCSA Prep2-5 min
The brief

Concept check, no lab machine: re-applying file labels needs a live SELinux kernel, and Signal9's lab machines run with SELinux disabled, so this one is a question rather than a hands-on lab. The hands-on half (writing the persistent file-context rule that relabeling applies) is the SELinux File Context Rule lab. You moved a page into /var/www/html with mv, so it kept its original user_home_t context instead of the httpd_sys_content_t that files there should have — and now httpd is denied and returns 403. The path already has a correct default context defined in policy; you just need to re-apply it. Which command resets the file's SELinux context to the policy's default for its path? Answer with just the command name (no arguments).

What you'll do
  • Recognise a wrong-label denial caused by mv preserving context
  • Restore the policy's default context for a path
  • Prefer re-applying the policy default over hand-setting a label with chcon

Knowledge check: answer from what you've learned, graded on the server.