简体   繁体   中英

Google Cloud SSh from one instance to another

I have been trying to ssh from one google cloud instance to another. I am able to SSH from my local machine which the host OS is windows and the VM OS which is Ubuntu.

I am running the commands straight from the website.

1.

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

2.

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

3.

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

The error I am getting is

ERROR: (gcloud.compute) Invalid choice: '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.

I can still do this, with gcloud version 97.0.0:

> 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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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