Tobi
Tobi

Reputation: 936

Cloud Shell loses authentication when connecting via ssh

I'm having problems with the new ssh-to-Cloud-Shell-instance command and tried to reset it several times already without success. I am connecting via: gcloud alpha cloud-shell ssh

After a couple of minutes I am loosing my gcloud authentication which means I have to re-authenticate, which is not the intended behavior:

Running gcloud info after a couple of minutes shows no active account:

Account: [None]
Project: [None]

I can work around this by putting a service account key file in my home directory and add a line to the bashrc file to make it authenticate when I am logging in, but that feels wrong. Also this fails again after a couple of minutes with:

Unable to connect to the server: error executing access token command "/google/google-cloud-sdk/bin/gcloud config config-helper --format=json": err=exit status 1 output= 

Upvotes: 1

Views: 456

Answers (1)

Erik Kuefler
Erik Kuefler

Reputation: 188

(I'm an engineer working on Cloud Shell at Google)

At the moment, gcloud doesn't send your authentication credentials to Cloud Shell when connecting via ssh. You can run gcloud auth login from within Cloud Shell after you connect, which should keep you authenticated for a while.

Note that this feature is currently in alpha and we're still refining it - we're currently exploring ways for gcloud to send these credentials so that you will be authenticated automatically, and expect this to be in place by the time the feature leaves alpha.

Upvotes: 2

Related Questions