007 Assign Sel Context To The Directory
007 Assign Sel Context To The Directory
Question:
Assign the same SELinux contexts used by the home directories to the /xfs directory permanently.
There is a command called chcon - however its usage is not advised (besides restoring root
password)!
Finding proper context to be applied is usually the most tricky part. However it is good to
remember that almost every Linux command that is used to list files/folders/processes/etc
has -Z flag, which will show the SELinux context of specified item. So we can use:
ls -Z /home
Context is the one with _t suffix. The way to assign it to mentioned /xfs target folder is this:
However above command only assigns this context to the policy. In order to write it to the
filesystem we need to invoke:
restorecon -R /xfs