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

linux – 如何仅允许ssh从本地网络root用户?

发布时间:2020-12-13 18:51:53 所属栏目:Linux 来源:网络整理
导读:我在CentOS 6.5计算机上安装了Google-Authenticator,并为某些用户配置了OTP. 编辑/ etc / ssh / sshd_config时,我看到了一个默认注释掉的指令“PermitRootLogin”. 我想设置“PermitRootLogin no”,但仍然只能从本地网络以root身份ssh到机器. 那可能吗? 解
我在CentOS 6.5计算机上安装了Google-Authenticator,并为某些用户配置了OTP.

编辑/ etc / ssh / sshd_config时,我看到了一个默认注释掉的指令“PermitRootLogin”.

我想设置“PermitRootLogin no”,但仍然只能从本地网络以root身份ssh到机器.

那可能吗?

解决方法

使用/ etc / ssh / sshd_config中的Match配置参数:
# general config
PermitRootLogin no 

# the following overrides the general config when conditions are met. 
Match Address  192.168.0.*
    PermitRootLogin yes

请参阅man sshd_config

(编辑:李大同)

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

    推荐文章
      热点阅读