Cannot ssh to google cloud instance - ssh

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.

Related

Default SSH Option disable GCP

I just created a VM but SSH option is disable i can't SSH.
Please Help how to enable SSH.
There could be a few issues that can cause this.
Is the instance running?
Did you try to ssh to the instance via Cloud Shell? I can see that you only have an internal IP address, so you can use this command:
gcloud compute ssh internal-instance-name --internal-ip
Do you have one of the following roles assigned? Owner, Editor, Compute Admin, Compute Instance Admin?
Is port 22 enabled under your firewall?
Also GCP has a really good ssh troubleshooting guide that can help you.

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

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.

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

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

Start ipython cluster using ssh on windows machine

I have a problem setting up a ipython cluster on a Windows server and connecting to this ipcluster using a ssh connection. I tried following the tutorial on https://ipython.org/ipython/doc/dev/parallel/parallel_process.html#ssh, but I have problems to understand what the options mean exactly and what parameters are to use exactly...
Could anyone help a total noob to set up an ipcluster? (Let's say the remote machine has ip 192.168.0.1 and the local machine has 192.168.0.2)
If you scroll roughly to the middle of the page https://ipython.org/ipython-doc/dev/parallel/parallel_process.html#ssh you will find this:
Current limitations of the SSH mode of ipcluster are:
Untested and unsupported on Windows. Would require a working ssh on Windows. Also, we are using shell scripts to setup and execute
commands on remote hosts.
That means, there is no easy way to build an ipcluster with ssh connection on windows (if it works at all).
Do you really need to connect the machines with an ssh connection? I guess it's possible with a ssh client on each windows machine, but if you are in a trusted local network you can also decide not to use the loopback interface and just expose the ports...
Sure you can start controller and engine separately! For further examples about ports (if you have problems with firewalls) see also How to setup ssh tunnel for ipython cluster (ipcluster)