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.
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
: