How to access your Google Cloud VM instance when SSH login fails?
How to use GCP Serial Console to address your SSH connection issues?
We had an issue with GC VM instance denied our SSH access even with the web console. It turned out to be a mistake made when editing
# This will deny all your ssh users!
Now we are going to show you how to gain SSH access when all common SSH login methods have failed. If you’re falling in this category, don’t try to attempt with generating/adding ssh keys or try to login with Google Cloud SDK, obvious nothing is going to work.
Luckily you can still use a startup script to create a sudo user, then use the Serial Console to login to your instance. Here is how to create the startup script:
Edit your VM instance, under Custom metadata add name startup-script and value as below:
To many, a business is a lifetime commitment. It's easy to start one yet difficult to make it successful. Attitude, skills, experiences and dedication help hone the craft along the way, but it's often the great vision and resilience to remain focused wins the game. Read more about me here