I'm new to using SSH and related technologies, so it's very possible I'm not understanding something basic.

I'm trying to SSH into a web server (that I own) and the connection is never established due to timeout.

~ $ ssh -vvv example.com
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/USER/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 102: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to example.com [] port 22.
debug1: connect to address IPADD port 22: Operation timed out
ssh: connect to host example.com port 22: Operation timed out

My first thought was that I had somehow specified the domain wrong, or that something was wrong with my site. So I tried connecting to the same domain via FTP, and that worked fine (was prompted for user name):

~ $ ftp
ftp> open
(to) example.com
Connected to example.com.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 2 of 50 allowed.
220-Local time is now 12:47. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (example.com:USER):

So then I thought maybe I was just using SSH wrong. I started watching this tutorial video. At about 1 minute in he does ssh [email protected] and gets a username prompt, but it gives me the same timeout as above. I then tried ssh google.com which does the same. ssh localhost, on the other hand, works fine. So the problem seems to be something to do with SSH requests over a network.

My next thought was that it may be a firewall issue. I do have Sophos installed on this machine, but according to my administrator it "should not" block outgoing SSH requests.

Can anyone help figure out why this is happening?

  • 9
    That is a live IP address you're giving us. It has an unsecured FTP connection running on it. This might not be a good idea. It also does not have anything running on port 22, which I suspect is the source of your problems. You can't just ssh into anything, the server needs to have an sshd running, this one doesn't seem to. If it's your server, turn ssh on and turn ftp off. You can do ftp over ssh once it's running.
    – marinus
    Commented Sep 13, 2015 at 17:11
  • 4
    No need to delete. I have edited the IP out and have asked SE to purge the edit history. That way, the person who answered you doesn't loose any reputation.
    – terdon
    Commented Sep 13, 2015 at 18:00

3 Answers 3


That error message means the server to which you are connecting does not reply to SSH connection attempts on port 22. There are three possible reasons for that:

  1. You're not running an SSH server on the machine. You'll need to install it to be able to ssh to it.
  2. You are running an SSH server on that machine, but on a nonstandard port. You need to figure out on which port it is running; say it's on port 2222, you then run ssh -p 2222 hostname.
  3. You are running an SSH server on that machine, and it does use the port on which you are trying to connect, but the machine has a firewall that does not allow you to connect to it. You'll need to figure out how to change the firewall, or maybe you need to ssh from a different host to be allowed in.

EDIT: as (correctly) pointed out in the comments, the third is certainly the case; the other two would result in the server sending a TCP "reset" package back upon the client's connection attempt, resulting in a "connection refused" error message, rather than the timeout you're getting. The other two might also be the case, but you need to fix the third first before you can move on.

  • 8
    If it weren't installed, or if it were running on a different port, then he would be getting connection refused messages.
    – Hut8
    Commented Sep 13, 2015 at 23:05
  • 3
    @Hut8: Is right. Of your 3 possibilities, only the third one (firewall) could possibly lead to timeouts. Commented Sep 14, 2015 at 4:17
  • 1
    On Ubuntu: sudo ufw allow 22; do your work then; sudo ufw deny 22. digitalocean.com/community/tutorials/…
    – Daniel
    Commented Mar 15, 2018 at 22:20
  • I think there is a 4th possibility which is that somehow the server is not accessible (Internet routing problems, something down in between...) Even if you can access other services because the route chosen can differ for ssh and other services. Commented Jul 10, 2019 at 7:41

Check by telnet command whether you're able to connect to SSH port 22. If you are not able to connect then check for it. First you should be able to connect on port no. 22 to server.

By default SSH port is 22. But if you have configured any other port then use that port instead of 22.

telnet < ip/url of server> < port>

e.g. telnet domain.com 22

  • 4
    This will time out just the same (otherwise the ssh -v log would've shown a connection succeeded, rather than saying it timed out) Commented Sep 13, 2015 at 21:50
  • @Wouter Verhelst yeah, thnx for clarification
    – AVJ
    Commented Sep 14, 2015 at 5:44
  • How can you check which port is configured? Configure a new port? Commented Mar 23, 2017 at 8:06
  • 1
    @YonatanSimson, assuming you have access, you can use sudo netstat -a64np (netstat) and search for the sshd server (last column). If you don't have access, you could try nmap. Commented Jul 10, 2019 at 7:53

This one seems dumb but it happened to me just now: make sure you're on the same network as the device you want to connect to. I was on my phone's hotspot wifi instead of the home wifi.

You can check this with ping: ping for instance. If you can't ping the machine you're not going to be able to connect to it. You're either on the wrong network or the machine is not running.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .