gcloud将ssh从一个VM计算到Google Cloud上的另一个VM

Tar*_*ary 6 ssh google-compute-engine google-cloud-platform gcloud

我正在尝试使用该gcloud compute ssh命令从Google Cloud中的另一个VM进入虚拟机.它失败并显示以下消息:

/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/compute/lib/base_classes.py:9: DeprecationWarning: the sets module is deprecated
  import sets

 Connection timed out
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255]. See https://cloud.google.com/compute/docs/troubleshooting#ssherrors for troubleshooting hints.
Run Code Online (Sandbox Code Playgroud)

我确保ssh键已经到位,但仍然无法正常工作.我在这里错过了什么?

uh_*_*boi 7

嗨,这个网站上有步骤来完成这个...

本节假设您事先使用SSH连接到外部可见实例,并使用gcloud.

在本地计算机上,使用以下命令启动ssh-agent以管理您的密钥:

me@local:~$ eval `ssh-agent`
Run Code Online (Sandbox Code Playgroud)

调用ssh-add将gcloud计算公钥从本地计算机加载到代理中,并将它们用于所有SSH命令以进行身份​​验证:

me@local:~$ ssh-add ~/.ssh/google_compute_engine
Run Code Online (Sandbox Code Playgroud)

使用外部IP地址登录实例,同时提供-A参数以启用身份验证代理转发.

gcloud compute ssh --ssh-flag="-A" INSTANCE
Run Code Online (Sandbox Code Playgroud)

来源:https://cloud.google.com/compute/docs/instances/connecting-to-instance#sshbetweeninstances.

我不确定'标志',因为它不适合我,也许我有一个不同的操作系统或Gcloud版本,它将适合你.