Google Cloud Services - 根本无法通过 SSH 连接到实例

Cap*_*bob 5 ssh virtual-machines ssh-keys google-compute-engine google-cloud-platform

我无法通过 SSH 连接到 Google Cloud 服务上的实例。

我不太熟悉虚拟机管理和故障排除,但已经尝试了我所知道的一切,谷歌可以提供给我,包括:

  • 尝试从外部程序进行 SSH
  • 将磁盘复制并安装到新实例上
  • 使用串行控制台连接到两者
  • 在不同的托管位置尝试上述所有操作

无论我尝试什么,唯一的结果是一个加载符号,后跟以下内容:

到项目元数据的密钥传输花费了异常长的时间。传输到实例元数据可能会更快,但只会将密钥传输到该虚拟机。如果您希望从此虚拟机通过 SSH 连接到其他虚拟机,则需要相应地传输密钥。

我不能这样做,因为我没有 GCloud 用于 SSH 进入实例的私钥,并且使用 PuTTY 根本不起作用,因为我给服务器的任何公钥都不起作用全部。

小智 -1

需要先启用公钥,然后第三方工具才能使用它们来访问 VM 实例,这是针对您尝试连接的 VM 执行的吗?

\n\n

可以通过 /var/log/auth.log 调试 SSH 访问问题(路径取决于操作系统,因此请查找适合您的操作系统版本的正确路径),或者您可以查看串行控制台输出 以查看一些其他详细信息,以帮助您排除故障问题。

\n\n

如果您确定了问题的可能根本原因,则可以启用对串行控制台的交互式访问来修复它。

\n\n

如果您没有\xe2\x80\x99没有root密码,您可以:

\n\n
1. Go to the VM instances page in Google Cloud Platform console. \n2. Click on the instance for which you want to add a startup script. \n3. Click the Edit button at the top of the page.\n4. Click on \xe2\x80\x98Enable connecting to serial ports\xe2\x80\x99\n5. Under Custom metadata, click Add item. \n6. Set \'Key\' to \'startup-script\' and set \'Value\' to this script: \n#! /bin/bash \nuseradd -G sudo USERNAME \necho \'USERNAME:PASSWORD\' | chpasswd \n7. Click Save and then click RESET on the top of the page. You might need to wait for some time for the instance to reboot. \n8. Click on \'Connect to serial port\' in the page. \n9.  In the new window, you might need to wait a bit and press on Enter of your keyboard once; then, you should see the login prompt. \n10.. Login using the USERNAME and PASSWORD you provided.\n
Run Code Online (Sandbox Code Playgroud)\n\n

串行控制台访问并不安全,因此建议您在完成工作后将其禁用。

\n\n

您还可以通过从Linux 来宾环境运行SSH 诊断脚本来调试此脚本,这些脚本包含在使用 Google 提供的公共映像创建的 Linux 实例中。

\n