<?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>single user mode &#8211; lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</title>
	<atom:link href="http://lifelinux.com/tag/single-user-mode/feed/" rel="self" type="application/rss+xml" />
	<link>http://lifelinux.com</link>
	<description>All About Linux !</description>
	<lastBuildDate>Thu, 20 Nov 2014 03:45:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.3</generator>
	<item>
		<title>How To Restore Default Permissions Of All Files Under / (ROOT)</title>
		<link>http://lifelinux.com/how-to-restore-default-permissions-of-all-files-under-root/</link>
					<comments>http://lifelinux.com/how-to-restore-default-permissions-of-all-files-under-root/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 20 Nov 2014 03:45:39 +0000</pubDate>
				<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[chmod]]></category>
		<category><![CDATA[chown]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[single user mode]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=1951</guid>

					<description><![CDATA[<p>Have you ever made a mistake and changed permissions of the folder and all it’s subfolders? And how to change back permissions of files/folders to default state ? Yesterday , I accidentally changed / (ROOT) permission to 777 with following command # chmod 777 -R / After that, All files and folders on my server [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-restore-default-permissions-of-all-files-under-root/">How To Restore Default Permissions Of All Files Under / (ROOT)</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>Have you ever made a mistake and changed permissions of the folder and all it’s subfolders? And how to change back permissions of files/folders to default state ?<br />
<span id="more-1951"></span></p>
<p>Yesterday , I accidentally changed / (ROOT) permission to 777 with following command</p>
<pre>
# chmod 777 -R /
</pre>
<p>After that, All files and folders on my server changed to 777 permissions. And I try to reboot my server, I can&#8217;t login into my server. It&#8217;s shown error: </p>
<pre>
Failed to start SSH server : Starting sshd:WARNING: UNPROTECTED PRIVATE KEY FILE! Permissions 0775 for '/etc/ssh/ssh_host_key' are too open. It is recommended that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: /etc/ssh/ssh_host_key Could not load host key: /etc/ssh/ssh_host_key
...
</pre>
<h2>How do I fix it ? </h2>
<p>If you can <a href="http://www.lifelinux.com/how-to-boot-into-single-user-mode-on-centos/">boot your system into Single User Mode</a>, then type 2 commands</p>
<pre>
# for p in $(rpm -qa); do rpm --setperms $p; done
# for p in $(rpm -qa); do rpm --setugids $p; done
</pre>
<p>Above command combination will reset all the permissions to the default permissions under CentOS / RHEL / Fedora Linux.</p>
<p>If you can&#8217;t boot into Single User Mode, Let boot from CentOS installation CD into <a href="https://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-rescuemode-boot.html">Recuse Mode</a>, make sure that your system mounted into /mnt/sysimage, And type the following command</p>
<pre>
# chmod 7777 -R /mnt/sysimage/
</pre>
<p>Note: Permission is 7777 not 777<br />
To change all files and folder to &#8220;7777&#8221; permission. And reboot your system. After that, You can boot into Single User Mode and type above commands.</p>
<h2>Reset default permissions of all files and folders under /home/ </h2>
<p>Type the following commands</p>
<pre>
# cd /home/
# for p in $(ll); do chown $p.$p -R /home/$p; done
# find . -type d -print0 | xargs -0 chmod 755
# find . -type f -print0 | xargs -0 chmod 644
# chmod 700 *
</pre>
<h2>Reset default permissions of all files and folders of MySQL (/var/lib/mysql)</h2>
<p>Type the following commands</p>
<pre>
# chown mysql.mysql -R /var/lib/mysql
# cd /var/lib/mysql
# find . -type d -print0 | xargs -0 chmod 700
# find . -type f -print0 | xargs -0 chmod 660
# chmod 777 *.sock
</pre>
<p>Finally, restart MySQL with following command</p>
<pre>
# /etc/init.d/mysqld restart
</pre>
<g:plusone href="http://lifelinux.com/how-to-restore-default-permissions-of-all-files-under-root/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-restore-default-permissions-of-all-files-under-root/">How To Restore Default Permissions Of All Files Under / (ROOT)</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/how-to-restore-default-permissions-of-all-files-under-root/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
