加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 从一个IP /主机名以外的所有IP地址限制root ssh

发布时间:2020-12-13 16:50:28 所属栏目:Linux 来源:网络整理
导读:我想限制来自除了单个IP地址之外的所有root ssh登录. 我的印象是我只需将其添加到/etc/pam.d/sshd: account required pam_access.so 这个/etc/security/access.conf: -:root:ALL EXCEPT IPADDRESS 但这似乎没有奏效. 解决方法 在/ etc / ssh / sshd_config
我想限制来自除了单个IP地址之外的所有root ssh登录.

我的印象是我只需将其添加到/etc/pam.d/sshd:

account required pam_access.so

这个/etc/security/access.conf:

-:root:ALL EXCEPT IPADDRESS

但这似乎没有奏效.

解决方法

在/ etc / ssh / sshd_config中
# Disable Root login
PermitRootLogin no
#
# [ . . . ]
#
# At the end of the file,add:
#
# Allow Root Login via Key from Admin Bastion
Match Address 10.9.8.7
        PermitRootLogin without-password

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读