Tip for SSH users with connection unexpectedly closed troubles

Phil Hassey phil at lance-tech.com
Thu Mar 8 17:32:04 GMT 2007

Thanks for rsync - it's great!  I use it for all my backups.

I use rsync via SSH.  Recently - I was having trouble with my backups:
rsync: connection unexpectedly closed (4968349 bytes received so far)
rsync error: error in rsync protocol data stream (code 12) at
io.c(453) [receiver=2.6.9]

After following all the steps in the FAQ and issues.html on the rsync
website, searching the mailing list, upgrading rsync, using the
rsync-debug script, and consulting a number of people someone
suggested that I add this to my ~/.ssh/config file:

ServerAliveInterval 5
ServerAliveCountMax 120

This fixed the problem -- apparently something between my backup and
primary servers was cutting the connection during pauses (I'm still
not sure which was, even after research all the points of failure I

I don't know if many other people have this trouble.  But if it is a
common problem, it'd be great to add a suggestion to issues.html under

Q:  Why does my transfer die with something like the following error?

If you are using rsync over SSH, make sure the connection isn't being
closed due to inactivity.  You may need  to add ServerAliveInterval
and ServerAliveCountMax parameters to your client side ~/.ssh/config


More information about the rsync mailing list