install DenyHost 反登录破解ssh密码

 

:检查安装要求

首选检查sshd是否支持Tcpwrap,只有支持Tcpwrap才可以安装Denyhost

  ldd /usr/sbin/sshd |grep wrap

再检查python的版本,python2.3以上版本可以直接安装

  python –V

 

 

:安装Denyhost

wget http://122.225.32.131/icons/DenyHosts-2.6.tar.gz

tar -xzvf  DenyHosts-2.6.tar.gz

 

 

 

 

cd DenyHosts-2.6

python setup.py install

 

四:进入程序脚本的目录,拷贝模板文件,设置好启动脚本的所属权限

cd  /usr/share/denyhosts/
cp daemon-control-dist daemon-control
chown  root  daemon-control
chmod  700  daemon-control

 

五:生成Denyhost的主配置文件,(将模板文件中开头是#的过滤后再导入到Denyhost.cfg
grep  -v  "^#"  denyhosts.cfg-dist  > denyhosts.cfg
vi denyhosts.cfg               ##此处暂停    DENY_THRESHOLD_ROOT   改为5

 

 

 

 

 

echo '/usr/share/denyhosts/daemon-control start' >> /etc/rc.d/rc.local

 

七:启动Denyhost的进程
/usr/share/denyhosts/daemon-control start

 

八: 可以查看到Denyhost在运行中

ps -ef |grep deny

 

 

 

关于排错

出现:
startingDenyHosts: /usr/bin/env python /usr/bin/denyhosts.py --daemon --config=/usr/share/denyhosts/denyhosts.cfg
DenyHostscouldnotobtainlock(pid:)
[Errno 17] File exists: '/var/lock/subsys/denyhosts'

使用:
rm -f /var/lock/subsys/denyhosts
./daemon-control start
startingDenyHosts: /usr/bin/env python /usr/bin/denyhosts.py –daemon –config=/usr/share/denyhosts/denyhosts.cfg
OK!
启动完成啦。
你可以使用
service denyhosts status来查看运行状态
 

 

 

 

六:将Denyhost启动脚本添加到自动启动中

 

三:进入安装目录并且执行执行Python脚本进行安装

你可能感兴趣的:(Install,ssh,denyhost,反登陆)