Tim Habersack

Where I put my things..

Rsync problem; connection refused

Jul 11th 2012

I was trying to rsync over some content between two linux servers (RHE5) at the office, and I kept getting:

servername: Connection refused rsync: connection unexpectedly closed (0 bytes read so far) rsync error: error in rsync protocol data stream (code 12) at io.c(165)

It was driving me batty. Rsync was set up on both servers, I could rsync from my workstation to either of them just fine. What was the problem rsync'ing between them??

I found excellent info in this ServerFault answer:

Try verbose mode in rsync by adding -vvv to see where it is failing. Are you using a very old version of rsync that doesn't default to using ssh (older than 2.6.0)? If so, try adding -e ssh to force ssh mode. -Phil Hollenback

I used the '-vvv' option to get very verbose output when I tried the command. And, ah ha! It was trying to use rsh for the connection.

Getting it to work was just a matter of adding the option '-e ssh' after my other options, and it worked!

(I'm going to start writing posts documenting problems I ran into, and how I fixed them. It helps me remember, and maybe could help others.)