本文原作者发表于:imcat.in我只是修改了下,可以在Debian下面安装
下载
wget http://www.imlei.me/down/DenyHosts-2.6.tar.gz
安装
tar -zxvf DenyHosts-2.6.tar.gz
cd DenyHosts-2.6
python setup.py install
修改配置文件
cp /usr/share/denyhosts/denyhosts.cfg-dist /usr/share/denyhosts/denyhosts.cfg
vi /usr/share/denyhosts/denyhosts.cfg
注意修改下面两项参数
SECURE_LOG = /var/log/auth.log
LOCK_FILE = /var/run/denyhosts.pid
然后是配置启动脚本
cp /usr/share/denyhosts/daemon-control-dist /usr/share/denyhosts/daemon-control
然后做一个小的修改
DENYHOSTS_BIN = “/usr/bin/denyhosts.py”
DENYHOSTS_LOCK = “/var/run/denyhosts.pid”
DENYHOSTS_CFG = “/usr/share/denyhosts/denyhosts.cfg”
修改权限
chown root /usr/share/denyhosts/daemon-control
chmod 700 /usr/share/denyhosts/daemon-control
继续
cd /etc/init.d
ln -s /usr/share/denyhosts/daemon-control denyhosts
update-rc.d denyhosts defaults
最后启动服务
/etc/init.d/denyhosts start
其他参考文章:http://www.howtoforge.com/preventing_ssh_dictionary_attacks_with_denyhosts