1、安装DenyHosts
# tar zxf DenyHosts-2.6.tar.gz
# cd DenyHosts-2.6
# python setup.py install
2、设置启动脚本
# cd /usr/share/denyhosts/
# cp daemon-control-dist daemon-control
# chown root daemon-control
# chmod 700 daemon-control
# grep -v "^#" denyhosts.cfg-dist > denyhosts.cfg
# vi denyhosts.cfg
PURGE_DENY = 30m
#过多久后清除
DENY_THRESHOLD_INVALID = 1
#允许无效用户(/etc/passwd未列出)登录失败的次数
DENY_THRESHOLD_VALID = 5
#允许有效(普通)用户登录失败的次数
DENY_THRESHOLD_ROOT = 3
#允许root登录失败的次数
E
HOSTNAME_LOOKUP=NO
#是否做域名反解
可以看看/etc/hosts.deny内是否有禁止的IP,有的话说明已经成功了。