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