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

前端 未结 15 920
渐次进展
渐次进展 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 08:05

    gcloud denies an ssh connection if there was a change in the setup, e.g. after you changed your default zone or region, or you created another instance. Then, you must update the ssh keys in your metadata by

    sudo gcloud compute config-ssh
    

    If this complains about different entries in your config file where your ssh key entries are stored, ~/.ssh/config, delete this file and execute the above command again.

    If you have installed gcloud without sudo, you can omit sudo.

    0 讨论(0)
  • 2020-12-08 08:05

    255 is the interactive ssh exit code for ssh failure - otherwise interactive ssh exits with the exit code of the last command executed in the ssh session.

    The next time you get exit code 255 from ssh try running with --ssh-flag="-vvv" (more v's => more debugging output) and see if it helps track down connection problems.

    0 讨论(0)
  • 2020-12-08 08:10

    For those who stop by this page. This helped me to solve the problem. Try to the following:

    1. Go to your Google and remove the SSH key for the server
      • Go to your google cloud console -> compute engine -> Metadata -> "SSH keys" tab and click on edit. Here you can delete the ssh keys.
    2. Run the gcloud command again

      • Click on the "Instances" link on the left side of your google cloud account, which will list down all the instances on the right side. Under connect column, you will see "SSH" drop-down, click on "View cloud Command" and this will bring a new dialog. Copy that command and run on your PC's terminal. This will let you SSH into the google compute engine.

    It seems a feature/issue from Google Cloud Platform itself, we are going to continue checking it.

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