Unable to connect to instance through SSH in google compute engine , another instance of same account works fine - ssh

I am trying to connect to my instance using gcloud compute ssh new-instance .. it's gives the following error:
ssh: connect to host 107.167.180.68 port 22: Connection refused
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
See https://cloud.google.com/compute/docs/troubleshooting#ssherrors for troubleshooting hints.
I had already tried all the possible solution mentioned in the google document.
Any suggestions on how to get a backup of the Database and file? The site has been down for the last two days
Thanks in advance

I'd recommend looking at the serial console output of the VM instance using gcloud compute instances get-serial-port-ouput or using "View serial port" button on the instance page in Cloud Console. That output should give you information about what is wrong with the VM, such as whether it runs out of memory or ran out of disk space or something like that. Also, make sure you didn't change the VM's network firewall rules to accidentally disallow incoming traffic on port 22.
The documentation page for SSH from the Browser also has some additional tips on how to explore this kind of issues - see here and here.

You can use the ssh keys with other instances of your account if you update the ssh keys in your metadata by
sudo gcloud compute config-ssh

Related

google colab ssh connection timesout

I am trying to follow the numerous tutorials and gists such as:
https://gist.github.com/creotiv/d091515703672ec0bf1a6271336806f0
https://stackoverflow.com/questions/48459804/how-can-i-ssh-to-google-colaboratory-vm/53252985#53252985
When I run the steps, it seems like everything went fine (I get the root password), but I do see this:
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
but unfortunately, after all the steps when I do the following on my local machine:
ssh -p17057 root#0.tcp.ngrok.io
I get:
ssh: connect to host 0.tcp.ngrok.io port 17057: Connection timed out
I am on vanilla Debian Buster - any pointers to why this is happening would be incredibly useful to debug
thank you.
I also had trouble ssh'ing into the ngrok tcp tunnel. I was using my local laptop as the access point to the colab VM. What I did was fire up an EC2 instance on AWS and use that instead. Also, I used ssh reverse tunnel and dropped the need for ngrok altogether since the ec2 machine already had a public IP. Check my answer here: https://stackoverflow.com/a/63186681/4126114

Cannot ssh to google cloud instance

I'm newbie for GCP and I need your help which this is the step I had made.
(1) I setup google cloud firewall rules to allow ssh on port 22 and I can ssh to my instance, CentOS7, correctly.
(2) When I connect to my instance, I run some firewall script and after that I cannot ssh to my instance anymore. It seem that script block ssh port even I enable it in the VPC Network > Firewall rules.
(3) Now I cannot connect to my instance including Open in browser window in the SSH menu on gcp console.
Is there any solution to connect my instance? Please help.
Thank in advance.
Bom
You probably change block ssh port by changing firewall configuration inside VM.
So you can consider 2 options :
1) Recreate VM if no sensitive data, or not too much work spent for the existing setup.
2) Detach Boot disk and reuse it on another instance, to change the configuration files of firewal.
check Official Docs - Use your disk on a new instance for that:
gcloud compute instances delete $PROB_INSTANCE
--keep-disks=boot
gcloud compute instances create new-instance
--disk name=$BOOT_DISK,boot=yes,auto-delete=no
gcloud compute ssh new-instance
Hope it will help you.

Unable to access vm instance via ssh anymore

I'm trying to see if there's anything I can do to re-gain access to my vm instance via SSH. I had access before, I was creating an ssh tunnel to another server and realized I used the wrong one. I killed ssh via 'pkill sshd' and figured I would be able to regain access after a minute however now I'm unable to at all. I just get connection refused, error 255. Is there any way to send a command to the vm instance to have it restart sshd?
Thanks!
Try using the serial console. Alternately, try rebooting the VM, there's a chance SSH will come up without an error if you give it another shot.

gcloud compute ssh can't connect at office's network

I'm running an instance on google cloud and I can access it normally using:
$ gcloud compute ssh instance-2
But I've got the following error when I try to access when I'm at office. I've tested rooting my mobile's internet and works fine. I tested on all instances and get the same response. Is that possible a rule that blocks my network in some way? I have a dynamically ip on my office's network.
$ gcloud compute ssh instance-2
No zone specified. Using zone [us-central1-c] for instance: [instance-2].
ssh: connect to host xx.xxx.xxx.xxx port 22: Connection timed out
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
After some days trying different solutions I finally found the problem.
The office's internet service provider has a setting that an ip number serve multiple clients, I opened a ticket and complained about the fact and they changed it. There are also some limitations in the modem, so I've changed the mode to bridge and connect another router to serve WiFi.

SSH Google Compute Engine down?

There's an issue with SSH access today ? Don't know why I can't access to my instances today, from a MobaXterm or the SSH webinterface in Google Cloud (impossible to connect port 22).
From Google Cloud Shell => ssh: connect to host XXXX port 22: Connection timed out
Global issue or only my account ?
I would advise you to try the following and check if you are able to connect:
Can you able to ping or SSH into VM instance using gcloud command ?
Could you also try running cloud shell in safe mode.
If you are still running the issue after trying 2 methods, please try to restart the cloud shell (This can be done by selecting restart option from hamburger menu on top right of your Cloud shell) and see if that fixes.
You can interact with the serial console so you can more easily troubleshoot instances that are not booting properly or that are otherwise inaccessible.
Please let me know of the results.