标签归档:No supported authentication methods available

解决Oracle Cloud免费服务申请的VPS无法登陆问题

现象描述

使用puttygen(0.71)生成RSA格式的公钥和私钥,粘贴在“创建计算实例”的“添加SSH密钥”下的“粘贴SSH密钥”中,申请免费的CentOS 7系统的VPS。

当使用命令行登陆VPS时,如:

ssh opc@12.34.56.78 -i .\key.ppk

出现 Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

改用putty在SSH-AUTh中选择私钥,登陆VPS,则提示:

No supported authentication methods available(server sent: publickey,gssapi-keyex,gssapi-with-mic)

原因

经多次尝试发现,Oracle的CentOS7 sshd_config 模板中未定义SSH的Protocol,因此登陆时默认使用Protocol 1模式,但命令行和putty默认使用Protocol 2,因此导致无法登陆。

解决方法

使用putty登陆,在putty的设置中,依次点击“Connection”-“SSH”-“Auth”,选中“Attempt TIS or CryptoCard auth (SSH-1)”,登陆即可。

(可选)登陆后可以修改SSH协议为2.

sudo vi /etc/ssh/sshd_config

添加一行

Protocol 2

重启SSH服务即可。