2008-08-19 19:30:36 +00:00
.TH "fixfiles" "8" "2002031409" "" ""
.SH "NAME"
fixfiles \- fix file SELinux security contexts.
.SH "SYNOPSIS"
2017-05-07 11:05:47 +00:00
.na
2008-08-19 19:30:36 +00:00
2017-05-07 11:05:52 +00:00
.B fixfiles
2022-02-18 09:20:57 +00:00
.I [\-v] [\-F] [-M] [\-f] [\-T nthreads] relabel
2017-05-07 11:05:52 +00:00
.B fixfiles
2022-02-18 09:20:57 +00:00
.I [\-v] [\-F] [\-T nthreads] { check | restore | verify } dir/file ...
policycoreutils: fixfiles: remove bad modes of "relabel" command
* `fixfiles -B relabel` or `fixfiles -C previouscontext relabel` would
skip the code that handles e.g. `/var/tmp`, which would be run by
`fixfiles relabel`. It would still remove all files in /tmp (subject to
user confirmation). This is confusing, undocumented, and unlikely to
be intentional.
* `fixfiles relabel path1 path2` is the same, except it would only relabel
the first path.
* `fixfiles -R ... relabel` was equivalent to `fixfiles -R ... restore`,
again contradicting the man page.
Also `fixfiles onboot` would ignore paths, -C, or -R.
fixfiles is mostly for users, where it should be acceptable to remove these
non-sensical combinations.
`fixfiles -C` is used in selinux-policy rpm install scripts. However I
believe the rpms used `fixfiles -C previouscontext restore`, and did not
either require user interaction or blow away /tmp without prompting. So
they should still work fine.
With these combinations removed, we can remove the `exit` calls which were
seen in some of the (non-error) code paths in `restore()`.
Signed-off-by: Alan Jenkins <alan.christopher.jenkins@gmail.com>
2017-05-07 11:05:54 +00:00
.B fixfiles
2022-02-18 09:20:57 +00:00
.I [\-v] [\-F] [\-B | \- N time ] [\-T nthreads] { check | restore | verify }
2008-08-19 19:30:36 +00:00
2023-06-01 14:39:11 +00:00
.B fixfiles
2022-02-18 09:20:57 +00:00
.I [\-v] [\-F] [\-T nthreads] \- R rpmpackagename[,rpmpackagename...] { check | restore | verify }
2009-11-03 15:37:13 +00:00
2017-05-07 11:05:47 +00:00
.B fixfiles
2022-02-18 09:20:57 +00:00
.I [\-v] [\-F] [\-T nthreads] \- C PREVIOUS_FILECONTEXT { check | restore | verify }
2017-05-07 11:05:47 +00:00
.B fixfiles
2022-02-18 09:20:57 +00:00
.I [-F] [-M] [-B] [\-T nthreads] onboot
2009-11-03 15:37:13 +00:00
2017-05-07 11:05:47 +00:00
.ad
2008-08-19 19:30:36 +00:00
.SH "DESCRIPTION"
This manual page describes the
.BR fixfiles
script.
.P
This script is primarily used to correct the security context
2023-06-01 14:39:11 +00:00
database (extended attributes) on filesystems.
2008-08-19 19:30:36 +00:00
.P
It can also be run at any time to relabel when adding support for
new policy, or just check whether the file contexts are all
2021-02-03 17:16:54 +00:00
as you expect. By default it will relabel all mounted ext2, ext3, ext4, gfs2, xfs,
jfs and btrfs file systems as long as they do not have a security context mount
2013-10-09 18:37:31 +00:00
option. You can use the \- R flag to use rpmpackages as an alternative.
2011-07-10 12:14:14 +00:00
The file /etc/selinux/fixfiles_exclude_dirs can contain a list of directories
2013-10-09 18:37:31 +00:00
excluded from relabeling.
2008-08-19 19:30:36 +00:00
.P
2023-06-01 14:39:11 +00:00
.B fixfiles onboot
2008-08-19 19:30:36 +00:00
will setup the machine to relabel on the next reboot.
.SH "OPTIONS"
2023-06-01 14:39:11 +00:00
.TP
2013-10-09 18:37:31 +00:00
.B \- B
If specified with onboot, this fixfiles will record the current date in the /.autorelabel file, so that it can be used later to speed up labeling. If used with restore, the restore will only affect files that were modified today.
.TP
.B \- F
Force reset of context to match file_context for customizable files
2008-08-19 19:30:36 +00:00
2023-06-01 14:39:11 +00:00
.TP
2013-10-09 18:37:31 +00:00
.B \- f
2008-08-19 19:30:36 +00:00
Clear /tmp directory with out prompt for removal.
2023-06-01 14:39:11 +00:00
.TP
2013-10-09 18:37:31 +00:00
.B \- R rpmpackagename[,rpmpackagename...]
2017-05-07 11:05:53 +00:00
Use the rpm database to discover all files within the specified packages and restore the file contexts.
2008-08-19 19:30:36 +00:00
.TP
2013-10-09 18:37:31 +00:00
.B \- C PREVIOUS_FILECONTEXT
2008-08-19 19:30:36 +00:00
Run a diff on the PREVIOUS_FILECONTEXT file to the currently installed one, and restore the context of all affected files.
2023-06-01 14:39:11 +00:00
.TP
2013-10-09 18:37:31 +00:00
.B \- N time
Only act on files created after the specified date. Date must be specified in
2013-11-06 12:24:01 +00:00
"YYYY\- MM\- DD HH:MM" format. Date field will be passed to find \- \- newermt command.
2013-10-09 18:37:31 +00:00
2020-08-06 14:48:36 +00:00
.TP
.B \- M
Bind mount filesystems before relabeling them, this allows fixing the context of files or directories that have been mounted over.
2013-10-09 18:37:31 +00:00
.TP
2012-02-03 16:56:39 +00:00
.B -v
2013-11-06 12:24:01 +00:00
Modify verbosity from progress to verbose. (Run restorecon with \- v instead of \- p)
2012-02-03 16:56:39 +00:00
2022-02-18 09:20:57 +00:00
.TP
.B \- T nthreads
Use parallel relabeling, see
.B setfiles(8)
2008-08-19 19:30:36 +00:00
.SH "ARGUMENTS"
One of:
2023-06-01 14:39:11 +00:00
.TP
2021-02-03 17:16:54 +00:00
.B check | verify
2008-08-19 19:30:36 +00:00
print any incorrect file context labels, showing old and new context, but do not change them.
2023-06-01 14:39:11 +00:00
.TP
2008-08-19 19:30:36 +00:00
.B restore
change any incorrect file context labels.
2023-06-01 14:39:11 +00:00
.TP
2008-08-19 19:30:36 +00:00
.B relabel
Prompt for removal of contents of /tmp directory and then change any incorrect file context labels to match the install file_contexts file.
2023-06-01 14:39:11 +00:00
.TP
.B [[dir/file] ... ]
2008-08-19 19:30:36 +00:00
List of files or directories trees that you wish to check file context on.
2023-06-01 14:39:11 +00:00
.SH EXAMPLE
.nf
Relabel the whole filesystem, except paths listed in /etc/selinux/fixfiles_exclude_dirs
# fixfiles relabel
Schedule the machine to relabel on the next boot and force relabeling of customizable types
# fixfiles -F onboot
Check labeling of all files from the samba package (while not changing any labels)
# fixfiles -R samba check
2008-08-19 19:30:36 +00:00
.SH "AUTHOR"
This man page was written by Richard Hally <rhally@mindspring.com>.
The script was written by Dan Walsh <dwalsh@redhat.com>
.SH "SEE ALSO"
2017-01-11 12:41:09 +00:00
.BR setfiles (8),
.BR restorecon (8)