ssh_exchange_identification: Connection closed by remote host

Published on and tagged with debian  problem

Today, as I tried to access a server with SSH, I got the following error:

ssh_exchange_identification: Connection closed by remote host

After some searching I found a solution: I have had to add the following line to /etc/hosts.allow:


And voilĂ , it works.

3 comments baked

  • MJR/slef

    Warning: that line will allow SSH access from any IPv4 address and there are a lot of scanners out there (machines which just try to guess logins with brute force). If you can, only put hosts, domains or networks which you want to have SSH access in there.

  • cakebaker

    @MJR/slef: Thanks for the warning, I changed it. Is it also an issue if a NAT device is used?

  • MJR/slef

    A NAT device can limit your checks: you can either allow or disallow connections which appear to be from the NAT device. Then again, most NAT devices I have seen can do firewalling too, so that’s not a major problem. Just another place to set access control…

© daniel hofstetter. Licensed under a Creative Commons License