![仅允许在其中一个服务器 IP 地址上进行 SSH](https://linux22.com/image/796361/%E4%BB%85%E5%85%81%E8%AE%B8%E5%9C%A8%E5%85%B6%E4%B8%AD%E4%B8%80%E4%B8%AA%E6%9C%8D%E5%8A%A1%E5%99%A8%20IP%20%E5%9C%B0%E5%9D%80%E4%B8%8A%E8%BF%9B%E8%A1%8C%20SSH.png)
我有一台具有多个 IP 地址的服务器,每个 IP 地址上都托管着网站。我有一个 IP 地址没有与之关联的网站。我想仅允许 SSH 登录到没有与之关联的一个 IP 地址。这可能吗?如果可以,有人能告诉我如何实现吗?
答案1
查看 sshd_config 中的 ListenAddress。
ListenAddress
Specifies the local addresses sshd(8) should listen on. The
following forms may be used:
ListenAddress host|IPv4_addr|IPv6_addr
ListenAddress host|IPv4_addr:port
ListenAddress [host|IPv6_addr]:port
If port is not specified, sshd will listen on the address and all
prior Port options specified. The default is to listen on all
local addresses. Multiple ListenAddress options are permitted.
Additionally, any Port options must precede this option for non-
port qualified addresses.