步骤

  • 编辑/etc/ssh/sshd_config
  • PasswordAuthentication参数值修改为no: PasswordAuthentication no
  • 重启ssh服务:systemctl restart sshd.service