I have edited the sshd_config file of my instance (Google Cloud Platform) to change port 22 to a new port. Add a new firewall rule for the port, but now I can't connect neither to 22 or to the port that I have configured. Nor can I access through the serial port. Anyone know any alternative to access the instance, or any option to not lose all my settings (databases, etc)


Create an ingress VPC firewall rule to allow the different ssh port.

Snapshot the broken instance's disk. Start a backup from this snapshot, just in case. Create a new disk from this snapshot and attach it as an additional disk to a working VM.

On the temporary instance, mount the copy of the broken disk. Edit sshd_config and any host firewalls. Test the sshd_config by starting another daemon with sshd -f.

Restore the fixed disk to an instance.

  • Thanks a lot... Do you have any tutorial for these ? – Juan Huerta Jul 30 at 12:43

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.