你的位置:首页 > 信息动态 > 新闻中心
信息动态
联系我们

linux限制SSH登录用户与登录方式

2021/12/28 0:35:55

2.3 限制SSH登录用户与登录方式

  1. 说明
    通过限制使用SSH直接以root身份登录,禁用公钥登录的方式加强SSH服务的安全性。
  2. 检查方法
    1)在终端中输入命令:
    [test@localhost ~]$ more /etc/ssh/sshd_config
    2)PermitRootLogin 为是否允许以root用户直接登录
    PubkeyAuthentication 为是否允许使用公钥方式登录
    PasswordAuthentication 为使用密码方式登录
  3. 修改建议
    1). vim编辑器修改SSH配置文件:
    [test@localhost ~]$ sudo vim /etc/ssh/sshd_config
    2).找到或添加以下内容:
    PermitRootLogin no
    PubkeyAuthentication no
    PasswordAuthentication yes