1

The problem seems to occur straight from the time I have installed Ubuntu 14.04 LTS.

I first realized this problem when I was trying to connect with my hosting at HostGator. I neglected and thought it's the problem with their side and continued to use their web-based file manager.

I lately come to use git, I couldn't do git push to remote server at GitHub.

$ git push -u origin master
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

This output from git command clearly states the problem is with my side and with ssh.

To verify that problem is with my side, I issued some more commands:

$ ssh -v sdf.org
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to sdf.org [192.94.73.15] port 22.
^Ydebug1: connect to address 192.94.73.15 port 22: Connection timed out
ssh: connect to host sdf.org port 22: Connection timed out

$ telnet sdf.org 22
Trying 192.94.73.15...
telnet: Unable to connect to remote host: Connection timed out

PS: I can still ping to the servers.

8
  • do you have a firewall installed that may be blocking you? iptables or something else?
    – dakka
    Jul 20, 2015 at 5:36
  • Did outbound ssh used to work in the past? What network are you connecting from (ISP, workplace, public wifi)?
    – mjturner
    Jul 20, 2015 at 7:16
  • @dakka I have no firewall. It's just a blank installation of Ubuntu. Jul 20, 2015 at 8:13
  • @mjturner Ubuntu 12.04 worked fine for me. By the way, I haven't tried with any other internet connection. I will try and tell you. I am using my phone to connect with the internet via USB tethering. Jul 20, 2015 at 8:15
  • @SantoshKumar Were you using the same internet connection with Ubuntu 12.04? I'm asking, because it wouldn't be surprising for a mobile provider to block outgoing ssh connections...
    – mjturner
    Jul 20, 2015 at 9:35

1 Answer 1

2

Some firewall between you and the target site is blocking TCP connections to port 22, either by blocking outgoing packets or by blocking the response.

You can locate the firewall by running tcptraceroute github.com 22.

If the firewall is beyond your control (e.g. on your ISP's equipment), there's nothing you can do without outside help. If your ISP is blocking these connections, check whether your contract restricts what you're allowed to do, and contact your ISP if your contract doesn't include any applicable restriction.

If you can't connect to port 22, you can use a tunnel. Port 443 is typically left open for outgoing connections because it's the port for HTTPS. But that means that you make a connection to an external machine on port 443, and then it forwards the traffic to github.com on port 22. You need to have an external machine capable of doing that. See How to use ssh over http or https? for some configuration instructions.

You must log in to answer this question.

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