[CentOS] ssh_exchange_identification: Connection closed by remote host

Tony Molloy tony.molloy at ul.ie
Sat Sep 15 09:46:28 EDT 2012


On Saturday 15 September 2012 14:01:38 Stephen Harris wrote:
> On Sat, Sep 15, 2012 at 07:01:03AM +0200, M. Fioretti wrote:
> > On Fri, September 14, 2012 11:48 pm, Stephen Harris wrote:
> > > 1) What happens if you run "telnet yourhost 22".
> >
> > this is what happens (with the proper IP of course):
> > >      Trying 1.2.3.4...
> > >      Connected to yourhost (1.2.3.4)
> > >      Escape character is '^]'.
> > >      Connection closed by foreign host.
> 
> This is important; it means the remote SSH server never says
>  'hello'.
> 
> > > 2) How quickly does the "closed" occur?
> >
> > I'd say 4/5 seconds
> 
> This is possibly indicative of resource starvation at the remote
>  end; the connection is going into the listen queue, then being
>  accepted but the process then fails.  It might mean "out of
>  memory" (for example) so the server can't fork() the new sshd
>  process.  If you mean "4 or 5s" then we might also be seeing
>  swapping delays.
> 
> There _are_ other reasons for this typ
>  network) but that's the most common one that I've seen.
> 
> > 
#####################################################
> > [marco at avalon ~]$ ssh -v -p xxx me at example.com
> 
> I assume the "xxx" here matches the port yo[root at thomond ~]# ssh -l 
root tmlinux.csis.ul.ie
> test.  Otherwise the telnet test is useless.
> 

As I said earlier in this thread that error can come from problems 
with the hosts.allow file on the machine you are trying to connect to.

I've just reproduced the error on my own systems.

Log in to tmlinux from thomond, everything ok.

edit the /etc/hosts.allow file on tmlinux  to disallow sshd access from 
thomond.

Log out.

Login to tmlinux from thomond. Error.
.
[root at thomond ~]# ssh -l root tmlinux.csis.ul.ie
ssh_exchange_identification: Connection closed by remote host

Since you changed your ISP you changed your IP address. If you had 
used the hosts.allow file to control access to ssh then that could be 
your problem. Same holds for telnet and any other network connection.

Regards,

Tony



ssssssss


More information about the CentOS mailing list