After a year using the VM instance in debian, we changed the ssh keys to connect to other computers, after having generated the pair of public and private keys with putty, and adding it to the metadata, we configured the filezilla and accessed the instance's fpt, but after about two hours we lost the connection to the server through port 22. Connection error occurs, "the server closed connection unexpectedly". Also with the GCP web access by SSH, the error is as follows:

An error has occurred during the communication with the SSH server Check the configuration of the server and the network. enter image description here

enter image description here

We have generated keys again and updated the metadata, we have tried to access through the gcloud terminal, and the error is the same. The firewall is activated to allow traffic through port 22.

Please any help on this error that you can give me, I will thank you very much. regard senter image description here


Try to SSH to the instance with the following flag to get debugging messages during the SSH process.

gcloud compute ssh <YOUR-INSTANCE-NAME> --zone <YOUR-INSTANCE-ZONE> --ssh-flag="-vvv"

As there are many reasons this could happen,I suggest you to take a look at these tips to troubleshoot and resolve common SSH issues.

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.