Can't SSH via gcloud or web or linux

20,134 views
Skip to first unread message

nurp

unread,
Mar 30, 2015, 9:58:32 PM3/30/15
to gce-dis...@googlegroups.com
I receive this error on Web ssh:
---------------
Connection Failed
We are unable to connect to the VM on port 22. Learn more about possible causes of this issue.
-----------

I have deleted my .ssh folder under windows and tried $ gcloud auth login and $ gcloud compute ssh myinstance:

------------------
...
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
The key fingerprint is:
....
Your private key has been saved in C:\Users\...ssh\google_compute_engine.
Your public key has been saved in C:\Users\....ssh\google_compute_engine.pub.
Your putty key has been saved in C:\Users\...\.ssh\google_compute_engine.ppk.
FATAL ERROR: Network error: Connection timed out
FATAL ERROR: Network error: Connection timed out
FATAL ERROR: Network error: Connection timed out
ERROR: (gcloud.compute.ssh) Could not SSH to the instance.  It is possible that your SSH key has not propagated to the i
nstance yet. Try running this command again.  If you still cannot connect, verify that the firewall and instance are set
 to accept ssh traffic.
------------

I have deleted my old VM instance and created a new one with new disk but still no luck.
SSH was always allowed in my networking settings but I tried to make it allow only to my IP address, still no difference.
Now it is 
Source IP Ranges
Allowed protocols and ports

22

What else can I do?

mia...@google.com

unread,
Apr 2, 2015, 10:59:33 AM4/2/15
to gce-dis...@googlegroups.com
Have a look at the serial output of your machines for more clues. You can find this in Developers Console > Compute > Compute engine > VM Instances > INSTANCE_NAME > scroll down to View console output. 

Did you try to connect from a different machine ? if you are able to ..this will rule out any firewall issues. Also, can you telnet to the instances on port 22 ? $ telnet IP 22 

nurp

unread,
Apr 2, 2015, 1:49:44 PM4/2/15
to gce-dis...@googlegroups.com
- Serial output is filled with these logs:
Apr  2 13:24:12 lamp-qqkq accounts-from-metadata: INFO Google SSH key schema identifier found.
Apr  2 13:24:12 lamp-qqkq accounts-from-metadata: INFO Google SSH key schema identifier found.
gcm-StatusUpdate:TIME=1427747583000;STATUS=ALL_COMMANDS_SUCCEEDED
Apr  2 13:24:37 lamp-qqkq accounts-from-metadata: INFO Google SSH key schema identifier found.
gcm-Heartbeat:1427981078000

- I tried telnetting to port 22 
Connecting To 146.148.XxX.xXX...Could not open connection to the host, on port 22: Connect failed

- Tried SSH'ing on ChromeBook, unfortunatelly it is still not accepting connections at port 22.


mia...@google.com

unread,
Apr 6, 2015, 8:20:23 AM4/6/15
to gce-dis...@googlegroups.com
It is strange that you cannot telnet to your IP. This definitely tells me that port 22 is not open on the GCE firewall.  My suggestions are : 

1. add a rule to GCE firewall : $ gcloud compute firewall-rules create mySSH --allow tcp:22 --source-ranges 0.0.0.0/0
2. test the rule by telnetting : $ telnet IP 22 
3. if telnet is working, than SSH is accepting connections, so try to ssh : $ gcloud compute ssh INSTANCE_NAME
4. If still not working, have a look at this Stackoverflow thread

nurp

unread,
Apr 6, 2015, 12:55:04 PM4/6/15
to gce-dis...@googlegroups.com
it worked!

I added the new rule, with lowercase name myssh.
the only different thing from what I did before was, I added only "22" in the port field instead "tcp:22"

it will stay mystery how in the first place it stopped working.
thanks a lot!

Code Guru

unread,
Oct 14, 2015, 6:53:02 AM10/14/15
to gce-discussion
not working for me. Even I tried to add SSH keys. When  I click on edit button of instance it shows existing SSH keys invalid. If I delete old SSH keys and add new one , it shows error "Invalid Fingerprint"

Faizan (Google Cloud Support)

unread,
Oct 14, 2015, 5:57:34 PM10/14/15
to gce-discussion
Hello Sunil,

Make sure your ssh key has the right format. You can refer to this link which has setups to add the ssh keys to metadata.

I hope that helps.

Faizan

Sudhakar Rapeti

unread,
Jan 10, 2016, 7:23:24 AM1/10/16
to gce-discussion
Hi Faizan,


    can you help me out my project instance suddenly stopped and now after clicking on ssh i am getting the error 

Connection Failed
We are unable to connect to the VM on port 22. Learn more about possible causes of this issue.

please i am stuck cant start open my shell my server code is there in server itself please help me

Faizan (Google Cloud Support)

unread,
Jan 11, 2016, 6:54:47 PM1/11/16
to gce-discussion
Hello Sudhakar,

I would recommend going through your instance's serial console output to see if you have errors or anything unusual. You can also try another ssh client (e.g. Putty) with verbose flag to get more information about the error which will be useful in debugging this issue further. You can refer to this link which has useful troubleshooting information about ssh errors.

If would like to recover the data from your instance you can delete this instance without deleting the boot disk and attaching this disk to another working instance for data recovery. 

I hope that help.

Faizan

Rodrigo Tanaka

unread,
May 15, 2016, 11:59:27 AM5/15/16
to gce-discussion
Faizan or somebody here...
Yesterday, suddenly, i couldn't acess my instance through Filezilla (or any other FTP software).
I couldn't acess my instance by Gcloud SDK too
I am still able to connect to it using the SSH interface in my Compute Engine Console.

My console output has those lines when i try to connect using gcloud:
May 15 11:11:48 arkterranova sshd[2601]: Connection closed by 120.26.235.115 [preauth]
May 15 11:16:01 arkterranova sshd[2667]: Received disconnect from 120.26.235.115: 11: Bye Bye [preauth]

Every time i try to connect using Filezilla or Gcloud i get those.

My firewall rules are ok and I can telnet port 22.

Any ideas? Please?

Patrick Dougall

unread,
Jul 1, 2016, 12:41:39 PM7/1/16
to gce-discussion
I'm just now having the same problem.  Did you get this resolved?  Any helpful ideas?

Francesco Emanuele Bucci

unread,
Nov 12, 2016, 10:49:32 PM11/12/16
to gce-discussion
I'm having same issues. After I deleted an external disk, I don't know if the things are related, I can't ssh into my instance in any way. An ssh in verbose mode tells me the connection times out.

Sanjay Rawat

unread,
Jan 29, 2017, 4:24:18 PM1/29/17
to gce-discussion
Hi guys,

I have been trying to access Compute Engine instance via ssh, but getting "Connection Time Out" error "ssh: connect to host 104.155.XX.XX port 22: Connection timed out"

I created the intance directly via GKE and also via Compute Engine, none worked.

I also cleared all the rules, rate limit, etc before creating new instances. Tried creating SSH keys locally and uploading the keys into Metadata, and this didn't work either.

So I am guessing this to be error from Google system? Coz even the SSH via browser is also not working.

Any help please!!

Dhandapani Sattanathan

unread,
Aug 19, 2017, 7:23:31 AM8/19/17
to gce-discussion

Hi,


Please check your ISP ( Internet Service Provider) may be they will block port 22.
I hope this will help all.

luntu magwebu

unread,
Jul 20, 2018, 1:02:00 PM7/20/18
to gce-discussion
I am also facing the same issue, how did you guys resolve it?

Milad (Google Cloud Platform)

unread,
Jul 20, 2018, 4:08:42 PM7/20/18
to gce-discussion
Hello Iuntu,

Firstly, check your firewall rules to make sure the SSH traffic is permitted (protocol/port: tcp/22). As there are many reasons this could happen, I recommend you to visit this article for some tips to troubleshoot and fix the issue. 

Allen Tools

unread,
Jul 30, 2019, 10:35:27 PM7/30/19
to gce-discussion
Same issue, created new VM, added key to meta data, checked firewall rules, how could an ISP block outgoing ssh? I don't think this makes sense but I've created a few VMs and tried everything I could think or find online.

Alexandre Duval-Cid

unread,
Jul 31, 2019, 4:46:12 PM7/31/19
to gce-discussion

If you go to your console and then in compute engine > [VM name] > vm details you should see serial port [1, 2, 3 ,4) (console) below the stackdriver logging.


In the serial port logs you can look for issues such as:


“Out of memory”

“No space left on device”


If no errors are found you should use the tool nmap to check your ports, if it shows as filtered then you know it’s network related.


For more information about ssh troubleshooting follow this article.


Hope this helps!




Reply all
Reply to author
Forward
0 new messages