The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

linux – ssh_exchange_identification: Connection closed by remote host (not using hosts.deny) – Unix & Linux Stack Exchange

Posted by jpluimers on 2020/07/17

I had this one day connecting to a guest:

debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 192.168.71.81 port 22

The cause was indeed a heavily overloaded box that would not respond in time to any actual data sent over network requests, but would accept the initial TCP connection.

Logging on the console also failed, but the memory and CPU usage on the wrapping host was out of the roof.

The only solution was to soft power-cycle the guest.

Very similar to:

You can also have a host who’s memory is so badly fragmented that it can’t allocate a page a contiguous memory to fork the process for hosting an SSH session.

In such a case, you can get either of the messages:

ssh_exchange_identification: read: Connection reset by peer

or:

Connection closed by aaa.bbb.ccc.ddd

depending on how far the host gets before it bails out.

If memory fragmenting is the apparent cause, the solution is to access the server via other means and to restart some of the pertinent services. I have found Apache and MySQL to be the culprit on VM’s since VM’s don’t have a swap partition. Failing that, reboot the host.

Via: [WayBacklinux – ssh_exchange_identification: Connection closed by remote host (not using hosts.deny) – Unix & Linux Stack Exchange

–jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.