Is it possible to use the Google Cloud Shell via a ssh?
Asked Answered
V

3

40

Is it possible to connect to the Google Cloud Shell instance via the ssh? Maybe somehow with gcloud? So I can use it with my favorite terminal (iTerm in particular) and not with the Web-based shell.

Answer: yes it is now been possible: https://cloud.google.com/blog/products/gcp/introducing-the-ability-to-connect-to-cloud-shell-from-any-terminal

Vidda answered 25/12, 2016 at 21:39 Comment(5)
I don't think so - the point is not to use it for long term use - from this page: cloud.google.com/shell/docs/features - When you start Cloud Shell, it provisions an f1-micro Google Compute Engine virtual machine running a Debian-based Linux operating system. Cloud Shell instances are provisioned on a per-user, per-session basis. The instance persists while your Cloud Shell session is active and terminates after an hour of inactivity.Kronos
see my answer it's possible nowButane
Can you revise the accepted answer.Butane
@Pentium10 doneVidda
answer has been plagiarized verbatim from here: cloud.google.com/blog/products/gcp/…Bugeye
V
21

Yes. From the gcloud CLI, run gcloud cloud-shell ssh. This will establish an interactive SSH session with Cloud Shell.

Reference:

Victimize answered 23/10, 2019 at 18:18 Comment(3)
For future readers, the CLI Cloud Shell Alpha version only works on Linux. For Windows (and Linux) I wrote a program that integrates your desktop with Cloud Shell and provides a lot of features. Source code is here: github.com/jhanley-com/google-cloud-shell-cli-goCurvilinear
Hm, i get a message: Access granted. Press Return to begin session. What if I do not need an interactive but an automated session?Ditto
It works for Windows as well.Briareus
J
1

Yes, you can do that with 3 simple steps:

  1. open a terminal in your local system
  2. install google-cloud-sdk : sudo snap install google-cloud-sdk --classic
  3. Authenticate google-cloud-sdk with your google account : gcloud auth login NOTE : After running this command , your default browser will be open and will ask you to authenticate
  4. After the autherization, go back to the terminal and run the following commad to get access into the shell : gcloud cloud-shell ssh NOTE : If you are doing this first time, it may walk you through creating ssh keys, if it's happen, in my case, i continue with empty password
  5. So, whenever you need that cloud shell , just run : gcloud cloud-shell ssh
Jugal answered 27/5, 2021 at 3:55 Comment(0)
N
0

You can connect to a vpn from the cloud shell, put the needed binary in your home directory and write the necessary startup scripts (connect to vpn and start daemon etc) on top of the .bashrc file so that it get executed when you start the shell from your browser.

I also suggest to use mosh becasue routing this way is pretty terrible and maybe run ssh cipherless since the vpn is already encrypted.

You could also cobble the heartbeat to keep the shell alive but that's probably too much in abuseland, having a pinned tab for the cloud shell seems good enough to me.

Necropsy answered 23/7, 2017 at 14:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.