{"id":2821,"date":"2022-12-20T15:17:23","date_gmt":"2022-12-20T18:17:23","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/restorecon-man8\/"},"modified":"2022-12-20T15:17:23","modified_gmt":"2022-12-20T18:17:23","slug":"restorecon-man8","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/restorecon-man8\/","title":{"rendered":"restorecon (man8)"},"content":{"rendered":"<h1 align=\"center\">restorecon<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#ARGUMENTS\">ARGUMENTS<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">restorecon \u2212 restore file(s) default SELinux security contexts.<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>restorecon<\/b> [<b>\u2212r<\/b>|<b>\u2212R<\/b>] [<b>\u2212m<\/b>] [<b>\u2212n<\/b>] [<b>\u2212p<\/b>] [<b>\u2212v<\/b>] [<b>\u2212i<\/b>] [<b>\u2212F<\/b>] [<b>\u2212W<\/b>] [<b>\u2212I<\/b>|<b>\u2212D<\/b>] [<b>\u2212x<\/b>] [<b>\u2212e<\/b> <i>directory<\/i>] <i>pathname\u00a0<\/i>&#8230;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>restorecon<\/b> [<b>\u2212f<\/b> <i>infilename<\/i>] [<b>\u2212e<\/b> <i>directory<\/i>] [<b>\u2212r<\/b>|<b>\u2212R<\/b>] [<b>\u2212m<\/b>] [<b>\u2212n<\/b>] [<b>\u2212p<\/b>] [<b>\u2212v<\/b>] [<b>\u2212i<\/b>] [<b>\u2212F<\/b>] [<b>\u2212W<\/b>] [<b>\u2212I<\/b>|<b>\u2212D<\/b>] [<b>\u2212x<\/b>]<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This manual page describes the <b>restorecon<\/b> program.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This program is primarily used to set the security context (extended attributes) on one or more files.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">It can also be run at any other time to correct inconsistent labels, to add support for newly-installed policy or, by using the <b>\u2212n<\/b> option, to passively check whether the file contexts are all set as specified by the active policy (default behavior).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If a file object does not have a context, <b>restorecon<\/b> will write the default context to the file object\u2019s extended attributes. If a file object has a context, <b>restorecon<\/b> will only modify the type portion of the security context. The <b>\u2212F<\/b> option will force a replacement of the entire context.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If a file is labeled with <b>customizable<\/b> SELinux type (for list of customizable types see \/etc\/selinux\/{SELINUXTYPE}\/contexts\/customizable_types), restorecon won\u2019t reset the label unless the \u2212F option is used.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">It is the same executable as <b>setfiles<\/b> but operates in a slightly different manner depending on its argv[0].<\/p>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>\u2212e\u00a0<\/b><i>directory<\/i><\/p>\n<p style=\"margin-left:22%;\">exclude a directory (repeat the option to exclude more than one directory, Requires full path).<\/p>\n<p style=\"margin-left:11%;\"><b>\u2212f\u00a0<\/b><i>infilename<\/i><\/p>\n<p style=\"margin-left:22%;\"><i>infilename<\/i> contains a list of files to be processed. Use \u201c<b>\u2212<\/b>\u201d for <b>stdin<\/b>.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212F<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>Force reset of context to match file_context for customizable files, and the default file context, changing the user, role, range portion as well as the type.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212h, \u2212?<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>display usage information and exit.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212i<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>ignore files that do not exist.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212I<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>ignore digest to force checking of labels even if the stored SHA1 digest matches the specfiles SHA1 digest. The digest will then be updated provided there are no errors. See the <b>NOTES<\/b> section for further details.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212D<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>Set or update any directory SHA1 digests. Use this option to enable usage of the <i>security.sehash<\/i> extended attribute.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212m<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>do not read <b>\/proc\/mounts<\/b> to obtain a list of non-seclabel mounts to be excluded from relabeling checks. Setting this option is useful where there is a non-seclabel fs mounted with a seclabel fs mounted on a directory below this.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212n<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>don\u2019t change any file labels (passive check). To display the files whose labels would be changed, add <b>\u2212v<\/b>.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>\u2212o\u00a0<\/b><i>outfilename<\/i><\/p>\n<p style=\"margin-left:22%;\">Deprecated &#8211; This option is no longer supported.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212p<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>show progress by printing the number of files in 1k blocks unless relabeling the entire OS, that will then show the approximate percentage complete. Note that the <b>\u2212p<\/b> and <b>\u2212v<\/b> options are mutually exclusive.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212R, \u2212r<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>change files and directories file labels recursively (descend directories).<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212v<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>show changes in file labels. Multiple -v options increase the verbosity. Note that the <b>\u2212v<\/b> and <b>\u2212p<\/b> options are mutually exclusive.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212W<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>display warnings about entries that had no matching files by outputting the <b>selabel_stats<\/b>(3) results.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u22120<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>the separator for the input items is assumed to be the null character (instead of the white space). The quotes and the backslash characters are also treated as normal characters that can form valid input. This option finally also disables the end of file string, which is treated like any other argument. Useful when input items might contain white space, quote marks or backslashes. The <b>\u2212print0<\/b> option of GNU <b>find<\/b> produces input suitable for this mode.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212x<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>prevent <b>restorecon<\/b> from crossing file system boundaries.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>ARGUMENTS <a name=\"ARGUMENTS\"><\/a> <\/h2>\n<p style=\"margin-left:22%; margin-top: 1em\"><i>pathname\u00a0<\/i>&#8230; The pathname for the file(s) to be relabeled.<\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\">1.<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\"><b>restorecon<\/b> by default does not operate recursively on directories. Paths leading up the final component of the file(s) are canonicalized using <b>realpath<\/b>(3) before labeling.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p>2.<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"83%\">\n<p>If the <i>pathname<\/i> specifies the root directory and the <b>\u2212vR<\/b> or <b>\u2212vr<\/b> options are set and the audit system is running, then an audit event is automatically logged stating that a &#8220;mass relabel&#8221; took place using the message label <b>FS_RELABEL<\/b>.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p>3.<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"83%\">\n<p>To improve performance when relabeling file systems recursively (i.e. the <b>\u2212R<\/b> or <b>\u2212r<\/b> option is set), the <b>\u2212D<\/b> option to <b>restorecon<\/b> will cause it to store a SHA1 digest of the default specfiles set in an extended attribute named <i>security.sehash<\/i> on each directory specified in <i>pathname\u00a0<\/i>&#8230; once the relabeling has been completed successfully. These digests will be checked should <b>restorecon \u2212D<\/b> be rerun with the same <i>pathname<\/i> parameters. See <b>selinux_restorecon<\/b>(3) for further details.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">The <b>\u2212I<\/b> option will ignore the SHA1 digest from each directory specified in <i>pathname\u00a0<\/i>&#8230; and provided the <b>\u2212n<\/b> option is NOT set and recursive mode is set, files will be relabeled as required with the digests then being updated provided there are no errors.<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This man page was written by Dan Walsh <dwalsh@redhat.com>. Some of the content of this man page was taken from the setfiles man page written by Russell Coker <russell@coker.com.au>. The program was written by Dan Walsh <dwalsh@redhat.com>.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>setfiles<\/b>(8), <b>fixfiles<\/b>(8), <b>load_policy<\/b>(8), <b>checkpolicy<\/b>(8), <b>customizable_types<\/b>(5)<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  restorecon \u2212 restore file(s) default SELinux security contexts. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5,52,4,172],"class_list":["post-2821","post","type-post","status-publish","format-standard","hentry","category-8-administracion-del-sistema","tag-5","tag-administracion","tag-man8","tag-restorecon"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/2821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=2821"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/2821\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=2821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=2821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=2821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}