1

This is the response when i ssh through console We are unable to connect to the VM on port 22. Learn more about possible causes of this issue.

This is the response when i ssh through gcloud Waiting for SSH key to propagate. ssh: connect to host 35.185.185.41 port 22: Operation timed out ERROR: (gcloud.compute.ssh) Could not SSH into the instance. It is possible that your SSH key has not propagated to the instance yet. Try running this command again. If you still cannot connect, verify that the firewall and instance are set to accept ssh traffic.

Please help me to solve this issue Thanks

3
2

Whenever you might have done some misconfigurations in your instance, you can use the interactive serial console to SSH into the instance. If you don't have the root password, you can use a script to set the root password as follows:

#! /bin/bash 
useradd -G sudo USERNAME
echo 'USERNAME:PASSWORD' | chpasswd 

You can set the key metadata to 'startup-script' and the 'Value' will be the script.

Restart the instance and use the password you just setup to login in to the interactive console.

As caution, when the issue is solved, disable as "the interactive serial console does not support IP-based access restrictions such as IP whitelists"

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.