简体   繁体   English

从一个实例到另一个实例的Google Cloud SSh

[英]Google Cloud SSh from one instance to another

I have been trying to ssh from one google cloud instance to another. 我一直在尝试从一个Google云端实例切换到另一个。 I am able to SSH from my local machine which the host OS is windows and the VM OS which is Ubuntu. 我可以从本地操作系统(主机操作系统为Windows)和VM操作系统(Ubuntu)进行SSH。

I am running the commands straight from the website. 我直接从网站运行命令。

1. 1。

me@local:~$ eval `ssh-agent`

2. 2。

me@local:~$ ssh-add ~/.ssh/google_compute_engine

3. 3。

gcloud compute ssh --ssh-flag="-A" INSTANCE

The error I am getting is 我得到的错误是

ERROR: (gcloud.compute) Invalid choice: 'ssh-flag=-A'. 错误:(gcloud.compute)无效的选择:“ ssh-flag = -A”。

Everything I see on internet is how to SSH into the VM but not how to SSH from one VM to another. 我在互联网上看到的所有内容都是如何通过SSH进入虚拟机,而不是如何从一个VM SSH到另一个VM。

I can still do this, with gcloud version 97.0.0: 对于gcloud版,我仍然可以这样做:

> gcloud compute ssh --ssh-flag="-A" --zone=us-central1-f user@ssh-test
Warning: Permanently added '104.197.77.90' (ECDSA) to the list of known hosts.

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
user@ssh-test:~$

Are you sure the command in #3 is copied correctly? 您确定#3中的命令已正确复制吗?

From your first instance do: 从您的第一个实例开始:

gcloud auth login

and you will be given a link, paste that into your browser, then login with the account of your second instance . 然后您将获得一个链接,将其粘贴到浏览器中,然后使用第二个实例的帐户登录。
You will then get a key paste that in your first instance terminal. 然后,您将在您的第一个实例终端中获得一个密钥粘贴。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM