 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Trashed Linux file permissions</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/trashed-linux-file-permissions/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/trashed-linux-file-permissions/</link>
	<description></description>
	<lastBuildDate>Fri, 24 May 2013 19:50:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: petkoa</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/trashed-linux-file-permissions/#comment-60758</link>
		<dc:creator>petkoa</dc:creator>
		<pubDate>Thu, 12 Mar 2009 15:50:12 +0000</pubDate>
		<guid isPermaLink="false">#comment-60758</guid>
		<description><![CDATA[Well finally, the proper code will be: (hopefully) 

echo “#! /bin/bash” &gt; my_script ;
find / -not -type l -not -regex “/\(sys\&#124;proc\&#124;dev\&#124;tmp\&#124;home\)/.*” -printf “chmod %m .%p\n” &gt;&gt; my_script ;
echo “# end” &gt;&gt; my_script ;
chmod 755 my_script


By,

petko]]></description>
		<content:encoded><![CDATA[<p>Well finally, the proper code will be: (hopefully) </p>
<p>echo “#! /bin/bash” &gt; my_script ;<br />
find / -not -type l -not -regex “/\(sys\|proc\|dev\|tmp\|home\)/.*” -printf “chmod %m .%p\n” &gt;&gt; my_script ;<br />
echo “# end” &gt;&gt; my_script ;<br />
chmod 755 my_script</p>
<p>By,</p>
<p>petko</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: petkoa</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/trashed-linux-file-permissions/#comment-60757</link>
		<dc:creator>petkoa</dc:creator>
		<pubDate>Thu, 12 Mar 2009 15:48:02 +0000</pubDate>
		<guid isPermaLink="false">#comment-60757</guid>
		<description><![CDATA[See, these backslashes disappeared again, though I used &quot;code&quot; button. Let me try escape them properly (?)

n
\n
\n]]></description>
		<content:encoded><![CDATA[<p>See, these backslashes disappeared again, though I used &#8220;code&#8221; button. Let me try escape them properly (?)</p>
<p>n<br />
\n<br />
\n</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: petkoa</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/trashed-linux-file-permissions/#comment-60756</link>
		<dc:creator>petkoa</dc:creator>
		<pubDate>Thu, 12 Mar 2009 15:45:46 +0000</pubDate>
		<guid isPermaLink="false">#comment-60756</guid>
		<description><![CDATA[Well, just posted and saw that code is &quot;censored&quot; by the system... I didn&#039;t use it&#039;s buttons and all backslashes disappeared:

&lt;pre&gt;find / -not -type l -not -regex “/(sys&#124;proc&#124;dev&#124;tmp&#124;home)/.*” -printf “chmod %m .%pn” &gt;&gt; my_script ;&lt;/pre&gt;

In -regex expression you should have backslashes before all ( and &#124; , in -printf expression - before final n.

Sorry,

Petko]]></description>
		<content:encoded><![CDATA[<p>Well, just posted and saw that code is &#8220;censored&#8221; by the system&#8230; I didn&#8217;t use it&#8217;s buttons and all backslashes disappeared:</p>
<pre>find / -not -type l -not -regex “/(sys|proc|dev|tmp|home)/.*” -printf “chmod %m .%pn” &gt;&gt; my_script ;</pre>
<p>In -regex expression you should have backslashes before all ( and | , in -printf expression &#8211; before final n.</p>
<p>Sorry,</p>
<p>Petko</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: petkoa</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/trashed-linux-file-permissions/#comment-60755</link>
		<dc:creator>petkoa</dc:creator>
		<pubDate>Thu, 12 Mar 2009 15:38:24 +0000</pubDate>
		<guid isPermaLink="false">#comment-60755</guid>
		<description><![CDATA[Hi,

I will try to suggest a way to prepare the &quot;correction&quot; script using &quot;find&quot; on the healthy system. Just run as root (but this time in the home directory ;o)):

echo &quot;#! /bin/bash&quot; &gt; my_script ;
find / -not -type l -not -regex &quot;/(sys&#124;proc&#124;dev&#124;tmp&#124;home)/.*&quot; -printf &quot;chmod %m .%pn&quot; &gt;&gt; my_script ;
echo &quot;# end&quot; &gt;&gt; my_script ;
chmod 755 my_script

It&#039;s important to exclude symbolic links because in fact their target is chmod-ed (which is probably not what we want).

You may opt not to exclude /tmp or /home (if you have no real users) but better keep yourself away from /dev, /proc and /sys. And they are dynamically populated anyway.

The dot before %p will be helpful if you can&#039;t start your trashed system - and better don&#039;t listen to me if I tell going to / and running anything from there .

You&#039;ll get something like this, just several tens Klines long (in 17 secons one of my servers produced ~75000 lines in a 4 MB file, so the generation time is not a problem - however, execution will take longer...) 

#! /bin/bash
...
chmod 755 ./bin/mknod
chmod 755 ./bin/mt-st
chmod 4755 ./bin/mount
chmod 4711 ./bin/ping6
chmod 755 ./bin/rmdir
chmod 755 ./bin/shred
...
# end

Well, the real problem will be execution on the trashed system. Most probably, you will not be able to start it - so, run some live CD distribution, mount the system root partition at some mount point, mount other partitions under the appropriate locations, cd to the mount point and run the transferred script.

Good luck,

Petko]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I will try to suggest a way to prepare the &#8220;correction&#8221; script using &#8220;find&#8221; on the healthy system. Just run as root (but this time in the home directory ;o)):</p>
<p>echo &#8220;#! /bin/bash&#8221; &gt; my_script ;<br />
find / -not -type l -not -regex &#8220;/(sys|proc|dev|tmp|home)/.*&#8221; -printf &#8220;chmod %m .%pn&#8221; &gt;&gt; my_script ;<br />
echo &#8220;# end&#8221; &gt;&gt; my_script ;<br />
chmod 755 my_script</p>
<p>It&#8217;s important to exclude symbolic links because in fact their target is chmod-ed (which is probably not what we want).</p>
<p>You may opt not to exclude /tmp or /home (if you have no real users) but better keep yourself away from /dev, /proc and /sys. And they are dynamically populated anyway.</p>
<p>The dot before %p will be helpful if you can&#8217;t start your trashed system &#8211; and better don&#8217;t listen to me if I tell going to / and running anything from there .</p>
<p>You&#8217;ll get something like this, just several tens Klines long (in 17 secons one of my servers produced ~75000 lines in a 4 MB file, so the generation time is not a problem &#8211; however, execution will take longer&#8230;) </p>
<p>#! /bin/bash<br />
&#8230;<br />
chmod 755 ./bin/mknod<br />
chmod 755 ./bin/mt-st<br />
chmod 4755 ./bin/mount<br />
chmod 4711 ./bin/ping6<br />
chmod 755 ./bin/rmdir<br />
chmod 755 ./bin/shred<br />
&#8230;<br />
# end</p>
<p>Well, the real problem will be execution on the trashed system. Most probably, you will not be able to start it &#8211; so, run some live CD distribution, mount the system root partition at some mount point, mount other partitions under the appropriate locations, cd to the mount point and run the transferred script.</p>
<p>Good luck,</p>
<p>Petko</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.011 seconds using memcached
Object Caching 310/313 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-24 23:01:18 -->