修改配置文件

Text
vi /etc/ssh/sshd_config
#PasswordAuthentication yes
改为
PasswordAuthentication no #改为禁用密码登录

重启ssh服务

Text
systemctl restart sshd.service