2

Problem is exactly as reported in

But it is not the "ssh_exchange_identification:" error, i.e., it's different than the ssh server: reasons for sudden "Connection closed by remote host" one.

I'm getting it while doing ssh -T:

$ ssh -T git@github.com
Connection to github.com closed by remote host.

The following message is generated when using ssh -vvv

debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 32000 rmax 35000
debug3: send packet: type 1
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r43 i0/0 o0/0 fd 5/6 cc -1)
Connection to github.com closed by remote host.

I've put the the full log (and diff with normal) to: https://www.diffchecker.com/LF2ZEb8j

For ssh -vvT git@github.com, I've put the the log diff to:
https://www.diffchecker.com/WjmA7P0c
from which there isn't much revealing.

Once again, the above problem is from (connecting from) my remote server, of version 1:7.6p1-4ubuntu0.7, which has been working for years, but have now broken for a few weeks. Testing/connecting from my home machine (ver: 1:8.4p1-5) always OK.

Comments?
Is it that my openssh-client 1:7.6p1-4ubuntu0.7 is too old for github.com?

$ apt-cache policy openssh-client
openssh-client:
  Installed: 1:7.6p1-4ubuntu0.7
  Candidate: 1:7.6p1-4ubuntu0.7
  Version table:
 *** 1:7.6p1-4ubuntu0.7 500
        500 http://azure.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1:7.6p1-4ubuntu0.5 500
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages 
     1:7.6p1-4 500
        500 http://azure.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
3
  • Probably. Try upgrading ssh. If you can't find a PPA with an updated ssh client for Ubuntu "Bionic Beaver" 18.04, download the packaged source (not the upstream source but the source package for ubuntu's ssh package) from "Jammy Jellyfish" 22.04 or "Kinetic Kudu" 22.10 and rebuild it on your bionic system (check the dependencies carefully, this may also require upgrading libssl and//or other packages). Alternatively, upgrade the entire system to the latest ubuntu LTS ("Jammy Jellyfish", 22.04) - bionic is from 2018, two LTS releases behind the current LTS release.
    – cas
    Sep 17, 2022 at 5:54
  • GitHub doesn't have a problem with old SSH versions. I can connect to GitHub just fine with openssh-client 1:7.6p1-4ubuntu0.5 on Ubuntu 18.04 or even with openssh-client 1:1.9.1-1ubuntu0.10 0 on Ubuntu 14.04. It's possible that your machine is behind a firewall that blocks certain connections, and either changing the SSH version or changing certain options might make that firewall happy. Sep 17, 2022 at 8:20
  • No @Gilles'SO-stopbeingevil', not a firewall issue -- my remote server is a normal Azure VM that I created myself, and it has been working for years, until recently. Besides, take a look of my answer -- same everything except openssh-client version will work. IMHO, it rules out anything except openssh-client version.
    – xpt
    Sep 18, 2022 at 3:02

2 Answers 2

2

This worked for me

Enabling SSH connections over HTTPS

If you are able to SSH into git@ssh.github.com over port 443, you can override your SSH settings to force any connection to GitHub.com to run through that server and port.

To set this in your SSH configuration file, edit the file at ~/.ssh/config, and add this section:

Host github.com
Hostname ssh.github.com
Port 443
User git

You can test that this works by connecting once more to GitHub.com:

$ ssh -T git@github.com
> Hi USERNAME! You've successfully authenticated, but GitHub does not
> provide shell access.

Using SSH over the HTTPS port

git clone ssh://git@ssh.github.com:443/USER_NAME/REPO_NAME.git
0

Is it that my openssh-client 1:7.6p1-4ubuntu0.7 is too old for github.com?

I had an idea to verify right after I posted my question, and It turns out that the answer is YES!

Here is how I tested/proved it

  • Install debian:latest docker image
  • Do ssh -T git@github.com within the debian:latest docker image

So all else are the same except for the openssh-client version, and it works within the debian:latest docker container.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.