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

我想限制来自除了单个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

相关文章

1、安装Apache。 1)执行如下命令,安装Apache服务及其扩展包...
一、先说一下用ansible批量采集机器信息的实现办法: 1、先把...
安装配置 1. 安装vsftpd 检查是否安装了vsftpd # rpm -qa | ...
如何抑制stable_secret读取关键的“net.ipv6.conf.all.stabl...
1 删除0字节文件 find -type f -size 0 -exec rm -rf {} ...
## 步骤 1:安装必要的软件包 首先,需要确保系统已安装 `dh...