ssh localhost报错 Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

参考:https://phoenixnap.com/kb/ssh-permission-denied-publickey

有可能是被禁用了密码登陆

解决方式:

编辑 /etc/ssh/sshd_config文件,开启密码登陆,

将PasswordAuthentication​设置成yes

将ChallengeResponseAuthentication​设置成no

PasswordAuthentication yes
ChallengeResponseAuthentication no

如果 root 账号要启动密码登陆,要再加上

PermitRootLogin yes

重启sshd

​sudo systemctl restart sshd​