无法通过 SSH 连接到 Google Compute Engine 实例

无法通过 SSH 连接到 Google Compute Engine 实例

我是谷歌云的新手,我刚刚部署了我的第一个实例,直到昨天它都运行良好,上次我使用这个教程来设置电子邮件服务器电子邮件服务器,但现在我无法在浏览器中连接 ssh,也无法在终端中连接 google cloud sdk。

网站运行正常,我不知道发生了什么,请帮忙

浏览器中的错误消息

Connection Failed, and we are unable to connect VM on port 22. 

终端中的错误消息

Warning: Permanently added 'xxx.xxx.xxx.xxx' (ECDSA) to the list of known hosts.
Permission denied (publickey).
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].

并且串行控制台输出其显示

Jul 8 10:09:26 Instance sshd[10103]: error: Could not load host key:/etc/ssh/ssh_host_ed25519_key

Jul 8 10:09:27 Instance sshd[10103]: User username from 0.0.0.0 not allowed because not listed in AllowUsers

Jul 8 10:09:27 Instance sshd[10103]: input_userauth_request: invalid user username [preauth] Jul 8 10:09:27 Instance sshd[10103]: Connection closed by 0.0.0.0 [preauth] – 

答案1

您正在更改 sshd 配置,并且输入了一些选项AllowUsers或类似的东西,这阻止您登录。不确定这份报告中到底是什么。DenyUserssshd_config

您可以尝试以不同的用户身份登录,但如果您不确定配置,这可能无济于事。

我不熟悉 google-compute-engine,但如果您可以使用串行控制台连接并发布您的信息sshd_config,我们就可以诊断并解决问题。

相关内容