Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a script which rsync's a local directory to about 10 remote servers. It basically has a list of the servers and for loops through each of them doing the rsync. To speed up the process I have it fork for each of the rsyncs, so that all 10 happen in parallel. The problem is the last few of the servers come back with a "ssh_exchange_identification: Connection closed by remote host". This doesn't happen when doing the rsyncs individually or in serial, and putting a half second delay in between each fixes the problem (usually, sometimes the last server in the list still returns the error).

Does anyone know why this would be happening? I assume it's an issue with rysnc and not my script, as the script just does a system call to rysnc anyway.

share|improve this question
up vote 6 down vote accepted

I have seen this issue before. You need to crank up the MaxStartups value on the SSH servers you are connecting to. Note the default value is 10. You can do this by editing /etc/ssh/sshd_config and reloading the SSH daemon (hopefully you control the remote servers).

From man sshd_config:

         Specifies the maximum number of concurrent unauthenticated connections to the SSH daemon.  Additional connections will be dropped until authentication succeeds or the
         LoginGraceTime expires for a connection.  The default is 10.

         Alternatively, random early drop can be enabled by specifying the three colon separated values “start:rate:full” (e.g. "10:30:60").  sshd(8) will refuse connection attempts
         with a probability of “rate/100” (30%) if there are currently “start” (10) unauthenticated connections.  The probability increases linearly and all connection attempts are
         refused if the number of unauthenticated connections reaches “full” (60).
share|improve this answer
Thanks for the help! I was wondering why this would work though? The number of ssh connections going to the remote servers individually is the same regardless of whether the connections are happening in serial or in parallel, so why would them being in serial alleviate this issue? – Mediocre Gopher Jul 17 '11 at 19:29
Take that back, you were right. Because I was actually ssh-ing into a box and then doing the rsyncs from that, the box I was ssh-ing into couldn't handle all the connections at once. Thanks! – Mediocre Gopher Jul 17 '11 at 19:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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