Centos 6、7 禁止密码验证登陆

Centos 6、7 禁止密码验证登陆

安全方面的考虑,秘钥对验证登陆相对密码验证要更安全

修改 /etc/ssh/sshd_config 配置文件

该配置文件中,只需要修改一个参数 PasswordAuthentication,把这个参数改为no即可

[root@node-1 ~]# grep 'PasswordAuthentication' /etc/ssh/sshd_config 
PasswordAuthentication no

修改之后,重启sshd服务即可

Centos 6

[root@node-1 ~]# /etc/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]

Centos 7

[root@node01 ansible]# systemctl restart sshd

这里修改,不影响控制台登陆

要提前配置好秘钥,否则只能控制台操作了。

posted @ 2018-10-18 11:47  司家勇  阅读(1578)  评论(0编辑  收藏  举报