首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SSH hosts.deny和hosts.allow

SSH hosts.deny和hosts.allow
EN

Server Fault用户
提问于 2011-12-31 11:47:28
回答 3查看 22.2K关注 0票数 3

我在hosts.deny中有这个内容(最后有一个新行):

代码语言:javascript
复制
#
# hosts.deny    This file describes the names of the hosts which are
#       *not* allowed to use the local INET services, as decided
#       by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.  In particular
# you should know that NFS uses portmap!

sshd : ALL

这在hosts.allow中是:

代码语言:javascript
复制
#
# hosts.allow   This file describes the names of the hosts which are
#       allowed to use the local INET services, as decided
#       by the '/usr/sbin/tcpd' server.
#

sshd: our.ip.add.ress: allow

然后,我们执行这段代码来重新启动SSH:

/etc/init.d/sshd restart

再一次,这是一个新的路线在最后。但是,我们仍然可以从另一个服务器访问SSH服务并尝试登录。我们做错什么了?

EN

回答 3

Server Fault用户

发布于 2011-12-31 12:02:43

您的/etc/hosts.deny,我认为您有语法错误。在"sshd“和冒号之间不应该有空格。因此,应改为:

代码语言:javascript
复制
sshd: ALL

在“允许”方面,我有这样的台词:

代码语言:javascript
复制
sshd: 192.168.1.1

在IP地址之后没有尾随文本。

票数 3
EN

Server Fault用户

发布于 2011-12-31 12:03:29

您不需要: allow in hosts.allow。它应该是这样的:

代码语言:javascript
复制
sshd: 192.168.2.200

如果您拥有控制台访问权限,您可以尝试阻止使用tcpwrappers的所有内容,以防服务名称出现问题:

hosts.deny

代码语言:javascript
复制
ALL: ALL

hosts.allow

代码语言:javascript
复制
ALL: 192.168.2.200
票数 3
EN

Server Fault用户

发布于 2012-01-01 01:03:54

值得检查的是,对的支持实际上已经编译到您正在使用的sshd中吗?

根据O‘’reilly蜗牛书,它需要使用-withlib包装物或- with包装选项中的任何一个进行编译。

(我不确定大多数发行版是否默认启用了它,或者open的默认编译时选项是什么)。

我刚才检查过我的:

代码语言:javascript
复制
ldd /usr/sbin/sshd | egrep 'wrap'

这表明

代码语言:javascript
复制
libwrap.so.0 => /lib64/libwrap.so.0 (0x00002ba50fa9c000)

(h/t至这个堆栈交换问题)

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/345558

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档