一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

ubuntu 14.04安装配置denyhosts步骤详解

时间:2022-06-30 19:16:36 编辑:袖梨 来源:一聚教程网


目前官网最新版本是2.10,记得以前的ubuntu版本(

安装

你可以前往官网http://s**ou*rceforge.net/projects/denyhost/ 选择一个你喜欢的版本下载,或者直接运行下面的命令下载。


cd /tmp/ && wget http://jaist.**dl.*sourceforge.net/project/denyhost/denyhost-2.10/denyhosts-2.10.tar.gz
#解压
tar xzvf denyhosts-2.10.tar.gz
#切换到目录
cd denyhosts
#安装
sudo python setup.py install

配置

经过上面这几步,基本已经完成了denyhosts 的安装,下面我们还需要进行一些配置。


#复制daemon文件到init.d 目录
sudo cp /usr/local/bin/daemon-control-dist /etc/init.d/denyhosts
sudo vim /etc/init.d/denyhosts
#A:将打开的文件里面的DENYHOSTS_BIN 修改为你自己denyhosts的目录,一般应该是/usr/local/bin/denyhosts.py
#B:或者是建立一个软连接
ln -s /usr/local/bin/denyhosts.py /usr/sbin/denyhosts

#注意:A或者B只需要执行一个就行了!
现在denyhosts 就已经安装配置好了,我们可以先把我们自己的IP加到系统的白名单里面


#编辑白名单

sudo vim /etc/hosts.allow

#按下面的样例添加你的IP

# /etc/hosts.allow: list of hosts that are allowed to access the system.
# See the manual pages hosts_access(5) and hosts_options(5).
#
# Example: ALL: LOCAL @wangheng.org
# ALL: .wangheng.org EXCEPT terminalserver.wangheng.org
#
# If you’re going to protect the portmapper use the name “rpcbind” for the
# daemon name. See rpcbind(8) and rpc.mountd(8) for further information.
#
sshd: 123.123.123.123
编辑保存后,我们需要重启一下服务:

sudo /etc/init.d/denyhosts restart

热门栏目