Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ssh

gcloud

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 the default firewall setting, which I believe would be good enough for ssh. But if I am missing something, please so indicate and suggest the fix for this error. Basically I can't get any efficient work done at this point having to ssh in so many times.

like image 289
Anh Nguyen Avatar asked Oct 04 '14 14:10

Anh Nguyen


2 Answers

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.

like image 196
Agile Bean Avatar answered Sep 24 '22 03:09

Agile Bean


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.

like image 36
Glenn Fowler Avatar answered Sep 22 '22 03:09

Glenn Fowler