connection closed by [ip_address] port 22 on GCP instance

534 views Asked by At

I was trying to mount a persistant disk with my GCP instance. From the official documentation of GCP on mounting persistent disk, for enabling automatic mounting disk on VM restart I should edit the "/etc" folder to inorder to add the UUID_VALUE to the fstab.backup file. But I was unable to edit because of the permissions. So I modified the permissions for the "/etc" folder. For example:

chmod -R 777 /etc 

Now I am not able to establish ssh connection with that GCP instance now, even from Web console and gcloud cli. It's giving me the error

Connection closed by [ip_address] port 22

How can I establish ssh connection with this GCP instance. Please help me to solve this issue, Thank you.

I tried to connect to this server through ssh from webcloud, gcloud cli,vscode...but nothing is working

1

There are 1 answers

1
Abdul Fahad On

You can check if the fstab is in a troubled state via GCP Serial Console: https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-using-serial-console

Also, another tick to fix this is to detach the VM Disk from the VM and attach it to another Linux VM and fix the troubled files in the mounted volume and then detach the fixed drive again and create VM using the VM (tested by me for fixing full root drives in the past).