Header Shadow Image


Linux: The source of ssh_exchange_identification: Connection closed by remote host

PROBLEM

You get this when trying to SSH to a host from some IP (Let's assume it's 111.22.33.44 for the scope of this problem):

ssh_exchange_identification: Connection closed by remote host

What to do?

SOLUTION

It had to do with security and /etc/hosts.allow in my case.  The steps are:

  • vi /etc/hosts.allow (Or if you prefer nano /etc/hosts.allow OR pico /etc/hosts.allow)
  • Add lines at the end such as:

# My Remote Host
sshd: 111.22.  

  • Above are examples of IP octets.  We are using 111.22 if the remote IP is 111.22.33.44 and CIDR is 111.22.0.0/16)
  • Save the file and exit (In VI use :wq! )
  • Try again from the IP of the remote host (In the above case, 111.22.33.44 )

Or at least that was the source of the issue for me.  Hope it helps!

Good Luck!
TK

2 Responses to “Linux: The source of ssh_exchange_identification: Connection closed by remote host”

  1. hello,

    I do have the same problem, but when I tried these steps, it didn’t worked for me. Am I somewhere wrong ?

    thanks & regards
    nicole.

  2. Hi Nicole,

    When ‘it does not work’ does it print anything out like an error message?

    You can also try:

    ssh -vvvvvvvv

    The more ‘v”s you have at the end of the -v the more debug messages ssh will print and tell you about what it is doing.

    Let me know how it goes,
    Tom

Leave a Reply

 


     
  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License