您的位置:首页 > 文档 > Shell >
 文章分类 

禁止从一个IP登录的shell


创建:2005-10-26 00:49:46
作者:Unlinux
来自: http://www.Unlinux.com

解决方案0:
用shell完全可以解决,如果有tcpwrapper的系统,可以直接加/etc/hosts.deny

解决方案1:
在/etc/profile里加一段shell就可以了(sco openserver)
这是我写的只要求本C段登陆的shell,改改就可以了.
who=`who am i|awk '{print $1}'`
myterm=`who am i|awk '{print substr($2,4,2)}'`
if [ "x"$who = "xroot" ]
then
subnet=`finger|grep $myterm|awk '{print substr($8,1,8)}'`
else
subnet=`finger|grep $myterm|awk '{print substr($7,1,8)}'`
fi
test x$subnet != x && test x$who != xroot && test "x"$subnet != "x46.8.44." &&
echo " Please login from local network
" && exit

转载自:http://www.unlinux.com/doc/shell/20051026/277.html

评论】 【加入收藏夹】 【 】 【打印】 【关闭
 *  请尊重我们的劳动,转载请注明出自UnLinux.Com及作者名 * 

※ 相关链接
无相关信息
Copyright © 2005 UnLinux.Com All Rights Reserved