<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[[实践OK]sudo: /etc/sudoers is mode 0640, should be 0440解决办法]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Unix/LinuxC技术]]></category>
<pubDate>Mon, 16 Mar 2015 02:09:53 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	背景：centos一兄弟把那个/etc/sudoer给权限变更了，于是否，出现sudo su -因为权限进入不了root，sudo su - sudo: /etc/sudoers is mode 0640, should be 0440 ，于是否，查了一下网络，有下面两种解决办法，特别是我自己有一个方法，那就是我有一个c文件是有root的权限，它能以root的权限让php去执行这个popen的类windows的cmd命令，于是在没有root密码的情况下也能修改这个文件，解决了问题。<br/>ubuntu或者CentOS中，/etc/sudoer 的权限为 0440时才能正常使用，否则sudo命令就不能正常使用。出现类似：sudo: /etc/sudoers is mode 0640, should be 0440 的对话。<br/>解决办法：<br/>1、Ctrl+Alt+F1&nbsp;&nbsp; 进入文本模式。用超级用户登录，如root<br/>2、输入：chmod 0440 /etc/sudoers&nbsp;&nbsp;。Enter<br/>3、exit 退出<br/>4、Ctrl+Alt+F7 返回图形模式。<br/>5、在试试sudo命令，可以用了<br/> <br/>P:其实另开一个端口，su -进入root,然后chmod 0440 /etc/sudoers&nbsp;&nbsp;<br/>效果是一样的<br/> <br/>example:<br/>[BIngo@windows ~]$ sudo chmod u+w /etc/sudoers<br/>口令：<br/>[BIngo@windows ~]$ ls -l /etc/sudoers<br/>-rw-r----- 1 root root 3210 11-16 02:40 /etc/sudoers<br/>[BIngo@windows ~]$ sudo chmod u-w /etc/sudoers<br/>sudo: /etc/sudoers is mode 0640, should be 0440<br/>[BIngo@windows ~]$ ls -l /etc/sudoers<br/>-rw-r----- 1 root root 3210 11-16 02:40 /etc/sudoers<br/> <br/>另开端口<br/>[root@windows ~]# chmod 0440 /etc/sudoers<br/>[root@windows ~]# exit<br/>[BIngo@windows ~]$ ls -l /etc/sudoers<br/>-r--r----- 1 root root 3210 11-16 02:40 /etc/sudoers<br/><br/>方法二（不是每台机器都有我这样的二进制，我是为了显示svn的版本号才临时用php调这个c，再用php调shell下的svn命令获取项目代码位置里的svn的版本号）：<br/>-rwsrwxrwx 1 root root 11711 Oct&nbsp;&nbsp;9 17:29 resetServerAndOptSVN //有root权限，它会调一个php文件，这个php的shell也有root权限，于是我只对php作了修改即可：<br/>vi resetServerAndOptSVN.php<br/><textarea name="code" class="php" rows="15" cols="100">
if ($argv[1] == &quot;disvnver&quot;) &#123; //查看SVN版本号
....
下面给修改成这这样：
&nbsp;&nbsp;&nbsp;&nbsp;$command = &quot;chmod 0440 /etc/sudoers&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;$handle&nbsp;&nbsp;= popen($command, &quot;r&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;do &#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$excuteResult = fread($handle, 1024);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (strlen($excuteResult) == 0) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$excuteResultAll .= $excuteResult;
&nbsp;&nbsp;&nbsp;&nbsp;&#125; while (true);
&nbsp;&nbsp;&nbsp;&nbsp;echo $excuteResultAll;
</textarea><br/><br/>./resetServerAndOptSVN disvnver jack<br/>于是，Ok了，这块主要是利用这个c编译的文件有root权限，让它去修改了权限，于是解决了问题~
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [实践OK]sudo: /etc/sudoers is mode 0640, should be 0440解决办法]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>