0
votes

I just created a new Instance on Google Cloud Compute engine but when I try connecting to terminal (via web SSH) it gets stuck into:

Connecting... Could not connect, retrying (2/3)… The VM serial console output may provide details to aid in troubleshooting connection problems. See our help document for other possible causes of this issue. You can drastically improve your key transfer times by migrating to OS Login.

If I check the serial console I see:

instance-2 login: Dec  9 09:50:50 instance-2 google-accounts: INFO Adding user sirjack9601 to the Google sudoers group.
[   27.313823] google_accounts_daemon[1526]: Adding user sirjack9601 to group google-sudoers
Dec  9 09:50:50 instance-2 google_accounts_daemon[1526]: Adding user sirjack9601 to group google-sudoers
Dec  9 09:51:16 instance-2 systemd[1]: systemd-hostnamed.service: Succeeded.
2
What command exactly do you type to connect to your VM? Using gcloud, you can use gcloud compute ssh [YOUR_VM_NAME].user8246956
@vicraj I use the built in ssh in the browser, from the instances page I click on the SSH button, for what I need is more than enoughTsadoq
OK, but using the gcloud command you could maybe diagnose whether the issue comes from the VM instance itself, or from the web SSH connection (just a suggestion).user8246956
@vicraj I did what you did and I don't have any error, I'm able to log using gcloud, thank you so much!!! I'd still like to understand why it doesn't work when using the web interface.Tsadoq
I've taken the liberty to add an answer so that it can help others facing the same issue. Concerning the SSH web connection, I humbly don't know why it doesn't work...user8246956

2 Answers

1
votes

Using gcloud, you can use the following command:

gcloud compute ssh [YOUR_VM_NAME]
1
votes

gcloud compute ssh works but web SSH does not work because your VM is IP restricted. Most likely your security does not want everyone who has access to the project to login to the VM.

The firewall rule allowing SSH access is enabled, but is not configured to allow connections from Cloud Console services. Source IP addresses for browser-based SSH sessions are dynamically allocated by Cloud Console and can vary from session to session. For the feature to work, you must allow connections either from any IP address or from Google's IP address range, which you can retrieve by using public SPF records.

See: https://cloud.google.com/compute/docs/ssh-in-browser