semanage-fcontext
Manage SELinux file context labeling rules
TLDR
List all file labeling rules
SYNOPSIS
semanage fcontext [-l|-a|-d|-m] [options] filespec_
DESCRIPTION
semanage fcontext manages persistent file context labeling rules in SELinux. File contexts determine what SELinux type label files receive, which controls what confined domains can access them.
Rules use PCRE regular expressions to match file paths. After adding or modifying rules, run restorecon on the affected directories to apply the new labels.
PARAMETERS
-l, --list
List all file context rules-a, --add
Add a new file context rule-d, --delete
Delete a file context rule-m, --modify
Modify an existing rule-t, --type _type_
SELinux type to assign to matching files-e, --equal _path_
Create equivalency rule from reference path-C, --locallist
Show only locally customized rules-n, --noheading
Omit column headings from output
CAVEATS
Requires root privileges. Rules are persistent but not applied automatically; use restorecon -Rv to apply. Equivalency rules (-e) are useful when a directory should have the same contexts as a reference path.
SEE ALSO
semanage(8), restorecon(8), matchpathcon(8), chcon(1)
