<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Running UNIX &#187; file permissions</title>
	<atom:link href="http://www.runningunix.com/tag/file-permissions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.runningunix.com</link>
	<description>UNIX/Solaris tips, tricks, and advice</description>
	<lastBuildDate>Sun, 25 Apr 2010 17:33:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Restoring File Permissions in Solaris</title>
		<link>http://www.runningunix.com/2009/01/restoring-file-permissions-in-solaris/</link>
		<comments>http://www.runningunix.com/2009/01/restoring-file-permissions-in-solaris/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 18:00:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Solaris]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[file permissions]]></category>
		<category><![CDATA[oops]]></category>

		<guid isPermaLink="false">http://www.runningunix.com/?p=177</guid>
		<description><![CDATA[Have you ever done something like this accidentally? 

# chmod -R 777 /usr
^C^C^C

Oops &#8211; You just changed some files in /usr to 777 before you were able to cancel. You don&#8217;t know how many or which files were affected. pkgchk can save you here.
In Solaris, there is a software &#8220;registry&#8221; file, /var/sadm/install/contents, which gives us [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever done something like this accidentally? </p>
<blockquote><p>
# chmod -R 777 /usr<br />
^C^C^C
</p></blockquote>
<p>Oops &#8211; You just changed some files in /usr to 777 before you were able to cancel. You don&#8217;t know how many or which files were affected. pkgchk can save you here.</p>
<p>In Solaris, there is a software &#8220;registry&#8221; file, /var/sadm/install/contents, which gives us information on every file installed on the system, or at least every file associated with a Solaris package. This file includes information about file permissions, owner and group information, file size and checksum.  Here&#8217;s an excerpt from the contents file:</p>
<blockquote><p>/etc/opt/SUNWexplo/t3files.txt f none 0444 root bin 123 11760 1208943439 SUNWexplu<br />
/etc/opt/SUNWexplo/t3input.txt e build 0400 root bin 590 45160 1208943439 SUNWexplu<br />
/etc/opt/SUNWexplo/tapeinput.txt e build 0400 root bin 885 6403 1208943439 SUNWexplu<br />
/etc/opt/SUNWexplo/xscfinput.txt e build 0400 root bin 758 60717 1208943439 SUNWexplu<br />
/etc/pam.conf e pamconf 0644 root sys 3103 17166 1219679093 SUNWcsr<br />
/etc/passwd e passwd 0644 root sys 672 56039 1219679093 SUNWcsr<br />
/etc/patch d none 0755 root sys SUNWppror<br />
/etc/patch/patch.conf v preserve 0644 root sys 365 31670 1186005379 SUNWppror<br />
/etc/patch/secret.conf v preserve 0600 root sys 207 17050 1186005379 SUNWppror<br />
/etc/path_to_inst v preserve 0444 root root 26 2566 1106347450 SUNWcsd<br />
/etc/power.conf e powerconf 0644 root sys 488 40965 1106350205 SUNWpmr<br />
/etc/printers.conf e preserve 0644 root sys 162 13902 1106350198 SUNWpcr<br />
/etc/profile e etcprofile 0644 root sys 712 51625 1219679093 SUNWcsr
</p></blockquote>
<p>The pkgchck command can be used to fix the file attributes (owner and group) of any or all package-installed files.</p>
<blockquote><p>
# pkgchk -f
</p></blockquote>
<p>This command would check every file listed in /var/sadm/install/contents, and if needed, change the owner and permissions of the files on the system to match the registry. Yes, this is sort of a shotgun approach, and you may not want to invoke changes this widely across the system. </p>
<p>In my example, only /usr was affected, so you can narrow down the criteria with a find command:</p>
<blockquote><p>
# find /usr -perm 777 -exec pkgchk -f -p {} \;
</p></blockquote>
<p>Or if you only changed one file, and now want it to change it back to whatever it was, just tell pkgchk to only work on the file you specify:</p>
<blockquote><p>
# pkgchk -f -p /etc/crypto/kcf.conf
</p></blockquote>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.runningunix.com%2F2009%2F01%2Frestoring-file-permissions-in-solaris%2F&amp;linkname=Restoring%20File%20Permissions%20in%20Solaris"><img src="http://www.runningunix.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.runningunix.com/2009/01/restoring-file-permissions-in-solaris/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
