This has been happening to me for weeks now and I have no idea why. I have tried making new VMs still happens, after I ssh once or twice then I can't do it anymore. Also when I hit troubleshoot everything is ticked.
I'm new to Google Cloud and also Linux-based systems.
Hi,
is this newly created machine or recreated from disk image / restored from backup ?
best
DamianS
This instance was created about 8 hours ago so yes very new.
Please read the documentation (Step 5: Set up IAP) about setting up IAP: https://cloud.google.com/iap/docs/tutorial-gce
Basically you need to allow GCP to access your VM via Browser, just create that firewall rule, apply it for your desired subnet and you should be able to SSH into your VM via Browser.
I tried my best at following the documentation on how to set up IAP at step 5, but still no progress, and still getting the same problem. probably didn't work because I'm new at this stuff and might have missed something.
All you have to do it's to create a Firewall rule like in my screenshot. Make sure you select the network that your VM uses and allow inbound connections on port 22 (SSH) from 35.235.240.0/20 (Google's CIDR block).
That should work.
I'm still having issues trying to ssh into the instance after doing what you said. But the weird thing is I can still SFTP into the instance through WinSCP, I don't know if that means something or not. I have also run troubleshooting through gc shell and comes back with no errors in the troubleshooting but if I try ssh using a shell command it says "Permission denied (publickey)".
That's a bit odd, SFTP is basically FTP through SSH.
Thanks for your help
I have found a workaround, I am now using a client ssh program and can now connect to my VM flawlessly so it was something to do with ssh through the google clouds browser-based one.
Also what's the best ssh client there is that I can use?
Hi,
I've got yesterday info about some issues related with GCE and ssh connections.
Maybe your problem was related to that. More info here : https://status.cloud.google.com/incidents/UHoBgMgvvQKa18JQjdbs
Regarding ssh client:
If Windows, use MobaXterm 🙂
If MacOS use native terminal (or iTerm). If you want to also use RDP client, use RoyalTSX
Personally I'm using macOS, so iTerm and paid version of RoyalTSX.
best,
DamianS
Try login in via serial console and change the port number from 22 to 2222 in /etc/ssh/sshd_config,
May be ftp is also running on port 22 .
use putty or Mobaxterm and login with custom port(2222)