<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[静怡家园]]></title> 
<link>http://www.zhanghaijun.com/index.php</link> 
<description><![CDATA[书山有路勤为径，学海无涯苦作舟！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[静怡家园]]></copyright>
<item>
<link>http://www.zhanghaijun.com/post/932/</link>
<title><![CDATA[Linux 如何禁止用户登录]]></title> 
<author>碟舞飞扬 &lt;webmaster@zhanghaijun.com&gt;</author>
<category><![CDATA[Linux技术]]></category>
<pubDate>Thu, 13 Jun 2013 12:20:25 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post/932/</guid> 
<description>
<![CDATA[ 
	在Linux上，有多种方式让不安份的用户无法登录。<br/><br/>1.修改用户配置文件/etc/shadow，将第二栏设置为“*”，如下。那么该用户就无法登录。但是使用这种方<br/><br/>式会导致该用户的密码丢失，要再次使用时，需重设密码[再次启用这个帐号的方法是把“*”去掉就可以了]<br/><br/>testid:*:15230:0:99999:7:::<br/><br/>2.使用命令usermod<br/><br/>usermod -L testid ##&nbsp;&nbsp;锁定帐号testid<br/>usermod -U testid ##&nbsp;&nbsp;解锁帐号testid<br/><br/>3.通过修改shell类型<br/>这种方式会更加人性化一点，因为你不仅可以禁止用户登录，还可以告诉他你这么做的原因。如下：<br/><br/>chsh testid -s /sbin/nologin #将用户testid的shell进行更改<br/> <br/>##修改/etc/nologin.txt(没有就新建一个)，<br/>##在里面添加给被禁止用户的提示<br/>#解禁用户的方式就是把shell改为他原有的就可以了。<br/><br/>4.禁止所有的用户登录<br/>如果你是root用户，当你不想让所有用户登录时（比如你要维护系统升级什么的），如果按上面的方式，一<br/><br/>个一个地去禁止用户登录，这将是很……无聊的事。而且还容易出错。下面有一种简洁有效的方式：<br/><br/>##在/etc目录下建立一个nologin文档<br/>touch /etc/nologin ##如果该文件存在，那么Linux上的所有用户（除了root以外）都无法登录<br/>##在/etc/nologin（注意：这可不是3中的nologin.txt啊！）写点什么，告诉用户为何无法登录<br/><br/>cat /etc/nologin<br/>9：00－10：00 系统升级，所有用户都禁止登录！<br/> <br/>##解禁帐号也简单，直接将/etc/nologin删除就行了！<br/>Tags - <a href="http://www.zhanghaijun.com/tags/chsh/" rel="tag">chsh</a> , <a href="http://www.zhanghaijun.com/tags/linux/" rel="tag">linux</a>
]]>
</description>
</item><item>
<link>http://www.zhanghaijun.com/post/932/#blogcomment2420</link>
<title><![CDATA[[评论] Linux 如何禁止用户登录]]></title> 
<author>秦尾同穿 &lt;g7rmfutv@expressemail.org&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 17 Sep 2013 13:52:44 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post/932/#blogcomment2420</guid> 
<description>
<![CDATA[ 
	不管怎样，都要顶一下的啦。
]]>
</description>
</item>
</channel>
</rss>