当前位置:Linux教程 - 网络安全 - 网络安全 - 限时登录

网络安全 - 限时登录

限时登录
2004-04-23 15:18 pm
来自:Linux文档
现载:Www.8s8s.coM
地址:无名

一个简单的限时登录方法! 自己写三个shell程序,调用at和系统维护功能: 1. 在指定的时间执行该shell,在/etc下生成一名为nologin的文件,如:
vi /sbin/login.denied
echo " Login Denied " > /etc/nologin
chmod 700 login.denied
2. 在指定的时间执行该shell,删除/etc/下的nologin文件,如:
vi /sbin/login.allowed
if [ -f /etc/nologin ]; then
rm /etc/nologin
fi
chmod 700 login.allowed
3. 编写一个限制时间的shell,如:
vi /sbin/security
if [ -f /sbin/login.denied ]; then
at -f /sbin/login.denid 22:00
fi
if [ -f /sbin/login.allowed ]; then
at -f /sbin/login.allowed 8:00
if
此种设置的功能是:从晚上10:00到第二天早上8:00静止非root用户登录,显示为系统维护状态。另外,还需对root用户的登陆终端进行限制,最好设置在console。在RedHat 5.0下,在/etc/security/access.conf中配置: -:root:ALL EXCEPT console就可以了。 注:还要参考/etc/securetty里的设置吧?