semanage-fcontext
Manage persistent SELinux security context rules on files/directories. tldr-pages
On Linux
Linux
List all file labeling rules
sudo semanage fcontext --listIdentifyList all user-defined file labeling rules without headings
sudo semanage fcontext --list --locallist --noheadingIdentifyAdd a user-defined rule that labels any path which matches a PCRE regex
sudo semanage fcontext --add --type samba_share_t '/mnt/share(/.*)?'IdentifyAdd a user-defined rule that creates a labeling equivalence between two subpaths
sudo semanage fcontext --add --equal /path/to/ref /path/to/targetIdentifyDelete a user-defined rule using its PCRE regex
sudo semanage fcontext --delete '/mnt/share(/.*)?'IdentifyRelabel a directory recursively by applying the new rules
restorecon -Rv path/to/directoryIdentify-RRecurse into directories toybox-vVerbose toybox