Question 1120
A RHEL 10 web-content directory /srv/web04 is subject to SELinux policy. The administrator must apply a previously defined default file context recursively. Which command performs that action?
Explanation
Correct Answer
restorecon applies the policy-defined default labels to existing files and directories It performs the requested label-management step. This matches the stated requirement to apply a previously defined default file context recursively. By contrast, the plausible alternative `ls -Z /srv/web04` has the effect: ls -Z displays the SELinux security context of listed filesystem objects It reads or applies a different part of SELinux context management; that operation would not achieve the requested result.
Incorrect Answers
semanage fcontext records the default SELinux labeling rule for files under this path It reads or applies a different part of SELinux context management. The stated task is to apply a previously defined default file context recursively. Instead, `restorecon -Rv /srv/web04` is the relevant alternative because restorecon applies the policy-defined default labels to existing files and directories It performs the requested label-management step.
ls -Z displays the SELinux security context of listed filesystem objects It reads or applies a different part of SELinux context management. The stated task is to apply a previously defined default file context recursively. Instead, `restorecon -Rv /srv/web04` is the relevant alternative because restorecon applies the policy-defined default labels to existing files and directories It performs the requested label-management step.
matchpathcon resolves the file-context policy entry for the named path It reads or applies a different part of SELinux context management. The stated task is to apply a previously defined default file context recursively. Instead, `restorecon -Rv /srv/web04` is the relevant alternative because restorecon applies the policy-defined default labels to existing files and directories It performs the requested label-management step.






Red Hat Certified System Administrator (RHCSA) (EX200) Practice Tests