We encountered an issue where a series of git requests over ssh would sometimes fail with ssh_exchange_identification: Connection closed by remote host

There are many examples on SE/SF of structural problems (tcp-wrappers, permission on key files).

Our problem was: What is a likely cause of intermittent connection failures with this message?

1 Answer 1


Our issue appeared to have been caused by a moderately high number of incoming requests.

As soon as the number of unauthenticated connections goes over the sshd:MaxStartUps parameter, sshd starts rejecting those connections.

The solution lies in modifying MaxStartups in sshd_config

  • 1
    It can also indicate a brute force attack, please make use of /etc/hosts.{allow,deny} files to limit connections. aboutlinux.info/2005/10/using-tcp-wrappers-to-secure-linux.html Nov 26, 2014 at 20:41
  • @AndrewMcGlashan it depends on the definition of moderately high number in this context. I think we had a Jenkins host checking out repositories from our git server, all within our own network. This host could very well handle the bursts, so we increased that limit. Nov 27, 2014 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.