setfiles
set SELinux file security contexts.
- Provided by: policycoreutils (Version: 2.2.5-1)
- Report a bug
set SELinux file security contexts.
setfiles [-c policy] [-d] [-l] [-n] [-e directory] [-o filename] [-p] [-q] [-s] [-v] [-W] [-F] spec_file pathname...
This manual page describes the setfiles program.
This program is primarily used to initialize the security context fields (extended attributes) on one or more filesystems (or parts of them). Usually it is initially run as part of the SELinux installation process (a step commonly known as labeling).
It can also be run at any other time to correct inconsistent labels, to add support for newly-installed policy or, by using the -n option, to passively check whether the file contexts are all set as specified by the active policy (default behavior) or by some other policy (see the -c option).
If a file object does not have a context, setfiles will write the default context to the file object's extended attributes. If a file object has a context, setfiles will only modify the type portion of the security context. The -F option will force a replacement of the entire context.
spec_file The specification file which contains lines of
the following form
regexp [ -type ] ( context | <<none>> )
The regular expression is anchored at both ends. The optional type field
specifies the file type as shown in the mode field by the ls(1)
program, e.g. -- to match only regular files or -d to match only
directories. The context can be an ordinary security context or the string
<<none>> to specify that the file is not to have its context
changed.
The last matching specification is used. If there are multiple hard links to a
file that match different specifications and those specifications indicate
different security contexts, then a warning is displayed but the file is
still labeled based on the last matching specification other than
<<none>>.
This man page was written by Russell Coker <russell@coker.com.au>. The program was written by Stephen Smalley <sds@epoch.ncsc.mil>