问题现象
当您通过SSH客户端登录ECS Linux实例时,输入正确的账号密码,也会出现类似如下错误信息。
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
sshd[10826]: Connection closed by XX.XX.XX.XX.
Disconnected: No supported authentication methods available.
原因分析
参数 PasswordAuthentication
的默认值为 yes
,SSH服务将其值置为 no
以禁用密码验证登录,导致此类故障。需要修改 PasswordAuthentication
配置解决此问题。
解决方法
建议在修改配置文件之前创建快照备份数据。以CentOS 6.9为例:
通过控制台VNC连接并登录到Linux实例。
执行命令
cat /etc/ssh/sshd_config
查看SSH服务配置,并注意是否包含类似如下配置:执行命令
vi /etc/ssh/sshd_config
,按下i
编辑SSH服务配置文件,将参数PasswordAuthentication
设置为yes
,或者在PasswordAuthentication
参数前添加井号(#),按下Esc
退出编辑模式,并输入:wq
保存退出。执行命令
service sshd restart
重启SSH服务。说明:如果您使用CentOS 7以上的镜像,执行命令
systemctl restart sshd
重启SSH服务。在控制台重启Linux实例。
使用SSH客户端重新登录Linux实例。