3

After clearing a project and instance of SSH key metadata and running gcloud compute ssh (which will create a new key pair and update project metadata), I am no longer able to SSH in without getting the "ssh: connect to host ..*.133 port 22: Connection refused" error.

I have read through every forum I can find involving this issue, yet I cannot come to a solution. I am even unable to connect through cloud shell terminal.

Is there something blatantly wrong with what I did?

  • Did you check the firewall rules? You have to allow the port 22 for your instance – miguelfrancisco85 Jan 17 '18 at 1:29
2

You can check if the instance is open to connections on port 22 by running sudo nmap -Pn -p 22 <instance IP>.

If you have port 22 open in the instance you should check the serial console output for errors in sshd.

If there are no errors, try testing connectivity to the instance by using telnet IP 22. You should get the SSH prompt. When testing try the internal IP and the external one (if you have one). If there is no SSH prompt, this would indicate that the service is down in the other instances. You might also try connecting to other VMs using the browser or the serial console to verify the service status.

| improve this answer | |
  • I actually can't do that because I can't log in with ssh in the first place... – Gulzar Jan 17 at 17:38
1

By enabling the serial port connection I was able solve the Connection refused issue. Please refer to this "Thinking in Software" blog where Nestor Urquiza infers that connecting to serial console restarts ssh. He says

Went ahead and activated the serial port access:

gcloud compute instances add-metadata myvm \
    --metadata=serial-port-enable=1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.