ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255]

前端 未结 15 918
渐次进展
渐次进展 2020-12-08 07:14

I kept getting kicked out of my compute engine instance after a few seconds of idle with the indicated error (255). I used \'gcloud compute ssh\' to log in. I am using t

相关标签:
15条回答
  • 2020-12-08 07:51

    If you have Identity-Aware Proxy (IAP) enabled for your setup, try adding the --tunnel-through-iap option to the gcloud compute ssh command.

    $ gcloud compute ssh --zone <zone> --project <project> --tunnel-through-iap <instance-name>
    
    0 讨论(0)
  • 2020-12-08 07:52

    Try switching to a different Internet connection


    So, I was getting the same error but in my case I was not able to log in to the instance at all.

    (base) girish@girish:~$ gcloud beta compute ssh --zone "asia-east1-b" "fp-1" --project "fp-public"
    ssh: connect to host 12.345.678.90 port 22: Resource temporarily unavailable
    ERROR: (gcloud.beta.compute.ssh) [/usr/bin/ssh] exited with return code [255].
    

    (base) girish@girish:~$ gcloud beta compute ssh  --ssh-flag='-vvv' --zone "asia-east1-b" "fp-1" --project "fp-public"
    OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug2: resolving "12.345.678.90" port 22
    debug2: ssh_connect_direct: needpriv 0
    debug1: Connecting to 12.345.678.90 [12.345.678.90] port 22.
    [debug1: connect to address 12.345.678.90 port 22: Resource temporarily unavailable
    ssh: connect to host 12.345.678.903 port 22: Resource temporarily unavailable
    ERROR: (gcloud.beta.compute.ssh) [/usr/bin/ssh] exited with return code [255].
    

    What worked for me: I tried reinstalling lots of things and re-initializing various config and then landed on a thread which suggest to change the Internet network you are using and it worked!!

    0 讨论(0)
  • 2020-12-08 07:54

    Reinitializing the gcloud with "gcloud init" and generating new ssh keys resolved the problem for me.

    0 讨论(0)
  • 2020-12-08 07:55

    If the default network was edited, or if not using the default network, you may need to explicitly enable ssh access by adding a firewall-rule:

    $ gcloud compute firewall-rules create --network=YOUR_NETWORK \
    default-allow-ssh --allow tcp:22
    

    After that, retry the 'gcloud compute ssh' command.

    0 讨论(0)
  • 2020-12-08 07:57

    In my case, the I had created a bootable disk for the VM without adding the information of what source-image it needs to have. Because of this, even though the instance was coming up alright and ssh-allow rule was there, the VM was not booting up.

    Finally added the source image to the disk and I was able to ssh into the VM.

    Hope this helps for someone.

    0 讨论(0)
  • 2020-12-08 07:58

    More information for people landing on this page, if you're using preemptible instances to save some compute costs, that could also be the reason for getting kicked out like this. Your instance may have just randomly stopped.

    0 讨论(0)
提交回复
热议问题