centos-ssh-密码登录设置

centos 设置 ssh 密码登录

root 用户下修改 sshd_config 文件

1
2
$ su -  // 切换root用户
$ vi /etc/ssh/sshd_config

修改 PasswordAuthentication(是否允许密码登录)

1
2
3
4
5
#PasswordAuthentication yes // 去掉前面的#,使之生效

改成

PasswordAuthentication no // 禁止密码登录

重启 sshd 服务

1
$ systemctl restart sshd