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:
ssh: 0.0.0.0/0.0.0.0
And voilĂ , it works.
5 Comments
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.
@MJR/slef: Thanks for the warning, I changed it. Is it also an issue if a NAT device is used?
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…
You’re better off looking at using DenyHosts (http://denyhosts.sourceforge.net/) as it will block known SSH boots.
Also add your own IP to /etc/hosts.allow in the form of IP addr/Netmask.
I also restrict password login in SSH and use shared keys. :) Avoids the problem with burte force password attacks.
@Strider: Thanks for the tips :)