Debian Codegraph @

policycoreutils/setfiles/restorecon.8

raw
1 .TH "restorecon" "8" "10 June 2016" "" "SELinux User Command"
2 .SH "NAME"
3 restorecon \- restore file(s) default SELinux security contexts.
4
5 .SH "SYNOPSIS"
6 .B restorecon
7 .RB [ \-r | \-R ]
8 .RB [ \-m ]
9 .RB [ \-n ]
10 .RB [ \-p ]
11 .RB [ \-v ]
12 .RB [ \-i ]
13 .RB [ \-F ]
14 .RB [ \-W ]
15 .RB [ \-I | \-D ]
16 .RB [ \-e
17 .IR directory ]
18 .IR pathname \ ...
19 .P
20 .B restorecon
21 .RB [ \-f
22 .IR infilename ]
23 .RB [ \-e
24 .IR directory ]
25 .RB [ \-r | \-R ]
26 .RB [ \-m ]
27 .RB [ \-n ]
28 .RB [ \-p ]
29 .RB [ \-v ]
30 .RB [ \-i ]
31 .RB [ \-F ]
32 .RB [ \-W ]
33 .RB [ \-I | \-D ]
34
35 .SH "DESCRIPTION"
36 This manual page describes the
37 .BR restorecon
38 program.
39 .P
40 This program is primarily used to set the security context
41 (extended attributes) on one or more files.
42 .P
43 It can also be run at any other time to correct inconsistent labels, to add
44 support for newly-installed policy or, by using the
45 .B \-n
46 option, to passively
47 check whether the file contexts are all set as specified by the active policy
48 (default behavior).
49 .P
50 If a file object does not have a context,
51 .B restorecon
52 will write the default
53 context to the file object's extended attributes. If a file object has a
54 context,
55 .B restorecon
56 will only modify the type portion of the security context.
57 The
58 .B \-F
59 option will force a replacement of the entire context.
60 .P
61 If a file is labeled with
62 .BR customizable
63 SELinux type (for list of customizable
64 types see /etc/selinux/{SELINUXTYPE}/contexts/customizable_types), restorecon
65 won't reset the label unless the \-F option is used.
66 .P
67 It is the same executable as
68 .BR setfiles
69 but operates in a slightly different manner depending on its argv[0].
70
71 .SH "OPTIONS"
72 .TP
73 .BI \-e \ directory
74 exclude a directory (repeat the option to exclude more than one directory, Requires full path).
75 .TP
76 .BI \-f \ infilename
77 .I infilename
78 contains a list of files to be processed. Use
79 .RB \*(lq \- \*(rq
80 for
81 .BR stdin .
82 .TP
83 .B \-F
84 Force reset of context to match file_context for customizable files, and the
85 default file context, changing the user, role, range portion as well as the type.
86 .TP
87 .B \-h, \-?
88 display usage information and exit.
89 .TP
90 .B \-i
91 ignore files that do not exist.
92 .TP
93 .B \-I
94 ignore digest to force checking of labels even if the stored SHA1 digest
95 matches the specfiles SHA1 digest. The digest will then be updated provided
96 there are no errors. See the
97 .B NOTES
98 section for further details.
99 .TP
100 .B \-D
101 Set or update any directory SHA1 digests. Use this option to
102 enable usage of the
103 .IR security.restorecon_last
104 extended attribute.
105 .TP
106 .B \-m
107 do not read
108 .B /proc/mounts
109 to obtain a list of non-seclabel mounts to be excluded from relabeling checks.
110 Setting this option is useful where there is a non-seclabel fs mounted with a
111 seclabel fs mounted on a directory below this.
112 .TP
113 .B \-n
114 don't change any file labels (passive check). To display the files whose labels would be changed, add
115 .BR \-v .
116 .TP
117 .BI \-o \ outfilename
118 Deprecated - This option is no longer supported.
119 .TP
120 .B \-p
121 show progress by printing the number of files in 1k blocks unless relabeling the entire
122 OS, that will then show the approximate percentage complete. Note that the
123 .B \-p
124 and
125 .B \-v
126 options are mutually exclusive.
127 .TP
128 .B \-R, \-r
129 change files and directories file labels recursively (descend directories).
130 .br
131 .TP
132 .B \-v
133 show changes in file labels. Multiple -v options increase the verbosity. Note that the
134 .B \-v
135 and
136 .B \-p
137 options are mutually exclusive.
138 .TP
139 .B \-W
140 display warnings about entries that had no matching files by outputting the
141 .BR selabel_stats (3)
142 results.
143 .TP
144 .B \-0
145 the separator for the input items is assumed to be the null character
146 (instead of the white space). The quotes and the backslash characters are
147 also treated as normal characters that can form valid input.
148 This option finally also disables the end of file string, which is treated
149 like any other argument. Useful when input items might contain white space,
150 quote marks or backslashes. The
151 .B \-print0
152 option of GNU
153 .B find
154 produces input suitable for this mode.
155 .TP
156 .SH "ARGUMENTS"
157 .IR pathname \ ...
158 The pathname for the file(s) to be relabeled.
159 .SH "NOTES"
160 .IP "1." 4
161 .B restorecon
162 does not follow symbolic links and by default it does not
163 operate recursively on directories.
164 .IP "2." 4
165 If the
166 .I pathname
167 specifies the root directory and the
168 .B \-vR
169 or
170 .B \-vr
171 options are set and the audit system is running, then an audit event is
172 automatically logged stating that a "mass relabel" took place using the
173 message label
174 .BR FS_RELABEL .
175 .IP "3." 4
176 To improve performance when relabeling file systems recursively (i.e. the
177 .B \-R
178 or
179 .B \-r
180 option is set),
181 the
182 .B \-D
183 option to
184 .B restorecon
185 will cause it to store a SHA1 digest of the default specfiles set in an extended
186 attribute named
187 .IR security.restorecon_last
188 on the directory specified in each
189 .IR pathname \ ...
190 once the relabeling has been completed successfully. This digest will be
191 checked should
192 .B restorecon
193 .B \-D
194 be rerun with the same
195 .I pathname
196 parameters. See
197 .BR selinux_restorecon (3)
198 for further details.
199 .sp
200 The
201 .B \-I
202 option will ignore the SHA1 digest from each directory specified in
203 .IR pathname \ ...
204 and provided the
205 .B \-n
206 option is NOT set and recursive mode is set, files will be relabeled as
207 required with the digest then being updated provided there are no errors.
208
209 .SH "AUTHOR"
210 This man page was written by Dan Walsh <[email protected]>.
211 Some of the content of this man page was taken from the setfiles
212 man page written by Russell Coker <[email protected]>.
213 The program was written by Dan Walsh <[email protected]>.
214
215 .SH "SEE ALSO"
216 .BR setfiles (8),
217 .BR fixfiles (8),
218 .BR load_policy (8),
219 .BR checkpolicy (8),
220 .BR customizable_types (5)