
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://selinuxproject.org/w/skins/common/feed.css?63"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://selinuxproject.org/w/?title=FileLabelRecipe&amp;action=history&amp;feed=atom</id>
		<title>FileLabelRecipe - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://selinuxproject.org/w/?title=FileLabelRecipe&amp;action=history&amp;feed=atom"/>
		<link rel="alternate" type="text/html" href="http://selinuxproject.org/w/?title=FileLabelRecipe&amp;action=history"/>
		<updated>2013-05-24T07:49:17Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.10.4</generator>

	<entry>
		<id>http://selinuxproject.org/w/?title=FileLabelRecipe&amp;diff=1002&amp;oldid=prev</id>
		<title>Jaxelson: added category</title>
		<link rel="alternate" type="text/html" href="http://selinuxproject.org/w/?title=FileLabelRecipe&amp;diff=1002&amp;oldid=prev"/>
				<updated>2010-08-31T18:28:28Z</updated>
		
		<summary type="html">&lt;p&gt;added category&lt;/p&gt;

			&lt;table border='0' width='98%' cellpadding='0' cellspacing='4' style=&quot;background-color: white;&quot;&gt;
			&lt;tr&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;Revision as of 18:28, 31 August 2010&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 10:&lt;/strong&gt;&lt;/td&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 10:&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; # ls -Z /path/to/myfile&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; # ls -Z /path/to/myfile&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; system_u:object_r:myfile_t /path/to/myfile&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; system_u:object_r:myfile_t /path/to/myfile&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;[[Category:Recipes]]&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jaxelson</name></author>	</entry>

	<entry>
		<id>http://selinuxproject.org/w/?title=FileLabelRecipe&amp;diff=823&amp;oldid=prev</id>
		<title>MurrayMcAllister: text review</title>
		<link rel="alternate" type="text/html" href="http://selinuxproject.org/w/?title=FileLabelRecipe&amp;diff=823&amp;oldid=prev"/>
				<updated>2009-11-25T10:19:35Z</updated>
		
		<summary type="html">&lt;p&gt;text review&lt;/p&gt;

			&lt;table border='0' width='98%' cellpadding='0' cellspacing='4' style=&quot;background-color: white;&quot;&gt;
			&lt;tr&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;Revision as of 10:19, 25 November 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 1:&lt;/strong&gt;&lt;/td&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 1:&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;If you want to &lt;/del&gt;change the context of a file &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the ''chcon'' program can do this.  However&lt;/del&gt;, changes made &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;this way will &lt;/del&gt;not preserved if the file is relabeled &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;by using ''&lt;/del&gt;restorecon&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/del&gt;or &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;using &lt;/del&gt;the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/del&gt;/.autorelabel&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' file &lt;/del&gt;and rebooting. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;The &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/del&gt;semanage&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/del&gt;program &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;is used to &lt;/del&gt;make customizations to the SELinux policy configuration.&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;The chcon program can &lt;/ins&gt;change the context of a file&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;; however&lt;/ins&gt;, changes made &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;with chcon are &lt;/ins&gt;not preserved if the file is relabeled &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;with &lt;/ins&gt;restorecon&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;or &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;if &lt;/ins&gt;the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;entire file system is relabeled using &amp;quot;touch &lt;/ins&gt;/.autorelabel&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot; &lt;/ins&gt;and &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;then &lt;/ins&gt;rebooting. The semanage program &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;can &lt;/ins&gt;make &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;persistent &lt;/ins&gt;customizations to the SELinux policy configuration.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;For example&lt;/del&gt;, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;if &lt;/del&gt;you &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;want &lt;/del&gt;to set the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;file '''&lt;/del&gt;/path/to/myfile&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''' to have the type '''myfile_t''', the following semanage command can be run&lt;/del&gt;:&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;To run semanage&lt;/ins&gt;, you &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;must be the Linux root user and in a role allowed to run semanage, such as sysadm_r or unconfined_r. The following example uses semanage &lt;/ins&gt;to set the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;myfile_t type for the &amp;quot;&lt;/ins&gt;/path/to/myfile&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot; file&lt;/ins&gt;:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; # semanage fcontext -a -t myfile_t /path/to/myfile&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; # semanage fcontext -a -t myfile_t /path/to/myfile&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;You must be the root Linux user and in a role allowed to run &lt;/del&gt;semanage&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, such as ''sysadm_r'' or ''unconfined_r''.&lt;/del&gt;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This &lt;/ins&gt;semanage &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;command adds &lt;/ins&gt;an entry in the system file contexts. This entry will be persistent, even &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;after &lt;/ins&gt;the distribution policy is updated. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;If &lt;/ins&gt;you change policies, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;for example, &lt;/ins&gt;from targeted to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;MLS&lt;/ins&gt;, you &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;must &lt;/ins&gt;re-run the above command to add &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the entry &lt;/ins&gt;to the new policy. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Run &lt;/ins&gt;the restorecon command &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;to apply &lt;/ins&gt;the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;changes added via &amp;quot;semanage fcontext&amp;quot;&lt;/ins&gt;:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This will add &lt;/del&gt;an entry in the system file contexts. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;This entry will be persistent, even &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;when &lt;/del&gt;the distribution policy is updated. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; However, if &lt;/del&gt;you change policies, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;e.g. &lt;/del&gt;from targeted to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;mls&lt;/del&gt;, you &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;will have to &lt;/del&gt;re-run the above command to add &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;it &lt;/del&gt;to the new policy. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; This can be tested by running &lt;/del&gt;the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/del&gt;restorecon&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/del&gt;command &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and examining &lt;/del&gt;the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;file's context afterward&lt;/del&gt;:&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; # restorecon /path/to/myfile&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; # restorecon /path/to/myfile&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; # ls -Z /path/to/myfile&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; # ls -Z /path/to/myfile&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; system_u:object_r:myfile_t /path/to/myfile&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; system_u:object_r:myfile_t /path/to/myfile&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>MurrayMcAllister</name></author>	</entry>

	<entry>
		<id>http://selinuxproject.org/w/?title=FileLabelRecipe&amp;diff=806&amp;oldid=prev</id>
		<title>JoshuaBrindle at 18:37, 19 November 2009</title>
		<link rel="alternate" type="text/html" href="http://selinuxproject.org/w/?title=FileLabelRecipe&amp;diff=806&amp;oldid=prev"/>
				<updated>2009-11-19T18:37:43Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table border='0' width='98%' cellpadding='0' cellspacing='4' style=&quot;background-color: white;&quot;&gt;
			&lt;tr&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;Revision as of 18:37, 19 November 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 1:&lt;/strong&gt;&lt;/td&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 1:&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;If you want to change the context of a file the ''chcon'' program.  However, changes made this way will not preserved if the file is relabeled by using ''restorecon'' or using the /.autorelabel file and rebooting.  The ''semanage'' program is used to make customizations to the SELinux policy configuration.&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;If you want to change the context of a file the ''chcon'' program &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;can do this&lt;/ins&gt;.  However, changes made this way will not preserved if the file is relabeled by using ''restorecon'' or using the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;/.autorelabel&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;file and rebooting.  The ''semanage'' program is used to make customizations to the SELinux policy configuration.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;For example, if you want to set the file '''/path/to/myfile''' to have the type '''myfile_t''', the following semanage command can be run:&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;For example, if you want to set the file '''/path/to/myfile''' to have the type '''myfile_t''', the following semanage command can be run:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 5:&lt;/strong&gt;&lt;/td&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 5:&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; # semanage fcontext -a -t myfile_t /path/to/myfile&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; # semanage fcontext -a -t myfile_t /path/to/myfile&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;You must be the root Linux user and in a role allowed to run semanage, such as sysadm_r or unconfined_r.&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;You must be the root Linux user and in a role allowed to run semanage, such as &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;sysadm_r&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;or &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;unconfined_r&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;This will add an entry in the system file contexts.  This entry will be persistent, even when the distribution policy is updated.  However, if you change policies, e.g. from targeted to mls, you will have to re-run the above command to add it to the new policy.  This can be tested by running the ''restorecon'' command and examining the file's context afterward:&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;This will add an entry in the system file contexts.  This entry will be persistent, even when the distribution policy is updated.  However, if you change policies, e.g. from targeted to mls, you will have to re-run the above command to add it to the new policy.  This can be tested by running the ''restorecon'' command and examining the file's context afterward:&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>JoshuaBrindle</name></author>	</entry>

	<entry>
		<id>http://selinuxproject.org/w/?title=FileLabelRecipe&amp;diff=781&amp;oldid=prev</id>
		<title>ChrisPeBenito at 15:05, 27 October 2009</title>
		<link rel="alternate" type="text/html" href="http://selinuxproject.org/w/?title=FileLabelRecipe&amp;diff=781&amp;oldid=prev"/>
				<updated>2009-10-27T15:05:27Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table border='0' width='98%' cellpadding='0' cellspacing='4' style=&quot;background-color: white;&quot;&gt;
			&lt;tr&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;Revision as of 15:05, 27 October 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 1:&lt;/strong&gt;&lt;/td&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 1:&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;If you want to change the context of a file the ''chcon'' program.  However, changes made this way will not preserved if the file is relabeled by using ''restorecon'' or using the /.autorelabel file and rebooting.&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;If you want to change the context of a file the ''chcon'' program.  However, changes made this way will not preserved if the file is relabeled by using ''restorecon'' or using the /.autorelabel file and rebooting. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; The ''semanage'' program is used to make customizations to the SELinux policy configuration.&lt;/ins&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;For example, if you want to set the file '''/path/to/myfile''' to have the type '''myfile_t''', the following semanage command can be run:&lt;/ins&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; # semanage fcontext -a -t myfile_t /path/to/myfile&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt; # semanage fcontext -a -t myfile_t /path/to/myfile&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;This will add an entry in the system file contexts.  This entry will be persistent, even when the distribution policy is updated.  However, if you change policies, e.g. from targeted to mls, you will have to re-run the above command to add it to the new policy.&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;You must be the root Linux user and in a role allowed to run semanage, such as sysadm_r or unconfined_r.&lt;/ins&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;This will add an entry in the system file contexts.  This entry will be persistent, even when the distribution policy is updated.  However, if you change policies, e.g. from targeted to mls, you will have to re-run the above command to add it to the new policy. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; This can be tested by running the ''restorecon'' command and examining the file's context afterward:&lt;/ins&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; # restorecon /path/to/myfile&lt;/ins&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; # ls -Z /path/to/myfile&lt;/ins&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; system_u:object_r:myfile_t /path/to/myfile&lt;/ins&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>ChrisPeBenito</name></author>	</entry>

	<entry>
		<id>http://selinuxproject.org/w/?title=FileLabelRecipe&amp;diff=780&amp;oldid=prev</id>
		<title>ChrisPeBenito: New page: If you want to change the context of a file the ''chcon'' program.  However, changes made this way will not preserved if the file is relabeled by using ''restorecon'' or using the /.autore...</title>
		<link rel="alternate" type="text/html" href="http://selinuxproject.org/w/?title=FileLabelRecipe&amp;diff=780&amp;oldid=prev"/>
				<updated>2009-10-27T14:52:08Z</updated>
		
		<summary type="html">&lt;p&gt;New page: If you want to change the context of a file the ''chcon'' program.  However, changes made this way will not preserved if the file is relabeled by using ''restorecon'' or using the /.autore...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;If you want to change the context of a file the ''chcon'' program.  However, changes made this way will not preserved if the file is relabeled by using ''restorecon'' or using the /.autorelabel file and rebooting.&lt;br /&gt;
&lt;br /&gt;
 # semanage fcontext -a -t myfile_t /path/to/myfile&lt;br /&gt;
&lt;br /&gt;
This will add an entry in the system file contexts.  This entry will be persistent, even when the distribution policy is updated.  However, if you change policies, e.g. from targeted to mls, you will have to re-run the above command to add it to the new policy.&lt;/div&gt;</summary>
		<author><name>ChrisPeBenito</name></author>	</entry>

	</feed>