ssh_exchange_identification: Connection closed by remote host

Recently trying to connect via ssh using cssh to a particular server from 26 other boxes at the same time I wasn’t able to connect from some of those boxes and saw this message on those:

[root@machine .ssh]# ssh -p 56789 [email protected]
ssh_exchange_identification: Connection closed by remote host

This was due to server configuration. Maximum default number of simultaneous connections tries (login attemps) is defined in /etc/ssh/sshd_config:

MaxStartups 10

We can change above value or use new-style format:

MaxStartups 10:30:60

Which stands for:

  • 10 – number of allowed simultaneous connections attempts. Above this number SSHD will start to randomly drop connections with percentage chance of 30%
  • 60 - number of simultaneous connections attempts after which SSHD will drop every new connection

Comments