Can't connect to GitHub from ssh Linux Mint 21

98 Views Asked by At

OpenSSH_8.9 timeout error to connect to GitHub

I have created my ssh keys. Below I have sent my public key to my GitHub profile -> SSH keys / Authentication Keys.

Although I have a connection to GitHub (with ping), when I try to connect via ssh it gives me a timeout error

# Connect to github
usu@serv:~$ ssh -vT [email protected]

OpenSSH_8.9p1 Ubuntu-3ubuntu0.4, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to github.com [140.82.121.3] port 22.
debug1: connect to address 140.82.121.3 port 22: Connection timed out
ssh: connect to host github.com port 22: Connection timed out

It seems to me that GitHub does not accept connections generated with the OpenSSH_8.9p1 version.

Therefore, I have been forced to install the OpenSSH-7.6 version (the Linux Mint 19 version) Which has forced me to install a previous (deprecated) version of OpenSSL-1.0.2u

# prerequisites
$ sudo apt install libssl-dev
$ sudo apt install zlib1g-dev libz-dev

# download
https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz
https://www.zlib.net/zlib-1.3.tar.gz
https://www.openssh.com/portable.html
  https://ftp.rnl.tecnico.ulisboa.pt/pub/OpenBSD/OpenSSH/portable/openssh-7.6p1.tar.gz

# install zlib-1.3
$ tar -xvf zlib-1.3.tar.gz
$ cd zlib-1.3
$ ./configure
$ sudo make
$ sudo make install

# install OpenSSL < 1.1.0
$ tar -xvf openssl-1.0.2u.tar.gz
$ cd openssl-1.0.2u
$ ./config
$ sudo make install

# install openssh-7.6
$ tar -xvf openssh-7.6p1.tar.gz
$ cd openssh-7.6p1
$ ./configure --without-zlib-version-check exec_prefix=/usr --without-openssl-header-check -with-ssl-dir=/usr/local/ssl
$ sudo make
$ sudo make install

1

There are 1 best solutions below

1
Jim Redmond On

This doesn't look like a client version mismatch - if that were the case, you'd be able to establish a TCP connection first, and then get dropped. (Also, I'm on OpenSSH_9.0p1 on this system, and I can SSH to GitHub just fine.)

Instead, this looks like something is preventing your connection to github.com:22 - probably a nearby firewall, but it could also be an ISP or higher-level entity. This is a fairly common practice, especially for wireless networks in public places or for many corporate networks.

Since you're apparently able to access GitHub using HTTPS, then you should also be able to use a special hostname for GitHub where the SSH daemon listens on port 443. Try ssh -Tvp443 [email protected] - if it returns your username, along with a message about how GitHub doesn't provide shell access, then you should be able to use SSH with GitHub using your existing client (just with a different host:port tuple). https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port has some additional suggestions which may help, including how to use ~/.ssh/config to abstract away the special host:port tuple.