Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Usually I use the command

rsync -av --delete someroot/somedir user@remote_server_ip:/someroot/.

on my development server to synchronize somedir to a remote server. It worked fine. But after the remote server was restarted this command does not work anymore. It displays the following error messages:

rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(463) [sender=2.6.8]

But the SSH service still works correctly. I can use ssh user@server_ipaddress to log in to the server. How can I make the rsync work again?

update: rsync also doesn't work locally. it gives error as follows:

[root@videochatweb1 web]# ./
building file list ... rsync: link_stat "/opt/web/client/index.php"     failed: Permission denied (13)

sent 29 bytes  received 20 bytes  98.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files could not be transferred (code 23) at main.c(892)    [sender=2.6.8]

update 2

I compiled the source code of rsync and reinstall it on the server.Now it works.Thanks for all the suggestions.

share|improve this question
Can you run rsync on the remote system? – Ignacio Vazquez-Abrams Apr 11 '12 at 2:51
@Ignacio Vazquez-Abrams,I try rsync from the server to another server,it gives me some error like rsync: Failed to exec ssh: Permission denied (13) rsync error: error in IPC code (code 14) at pipe.c(83) [sender=2.6.8] rsync: writefd_unbuffered failed to write 4 bytes [sender]: Broken pipe (32) rsync error: error in IPC code (code 14) at io.c(1119) [sender=2.6.8] – SpawnST Apr 11 '12 at 2:54
Does it work locally on that server? – Ignacio Vazquez-Abrams Apr 11 '12 at 2:55
@Ignacio Vazquez-Abrams,what do u mean locally?just run rsync alone? – SpawnST Apr 11 '12 at 2:56
Just rsync from one directory to another. – Ignacio Vazquez-Abrams Apr 11 '12 at 2:57

Since the error message says "error in rsync protocol", this indicates that rsync is using the rsync protocol for communication and not ssh. So your test that shows that ssh is working is immaterial, but can lead to a solution.

I think that the remote server may have been running rsync as a daemon (rsync --daemon) prior to reboot. It wasn't restarted automatically after reboot.

I see two solutions:

  1. Restart rsync --daemon on the remote server. Put it into something in /etc/init.d or similar so that it restarts after the next reboot.
  2. Use ssh protocol for rsync instead.

To use ssh for rsync, set the environment variable:

export RSYNC_RSH=ssh

or add -e ssh to your rsync command.

share|improve this answer
rsync on the local system talks to rsync on the remote system using the rsync protocol. ssh is only the transport. – Ignacio Vazquez-Abrams Apr 11 '12 at 15:37
rsync --daemon listens on port 873 (by default). This is independent of ssh – Doug Harris Apr 11 '12 at 15:53
Daemon mode has nothing to do with the question. The default transport for rsync is ssh unless a double colon is used. – Ignacio Vazquez-Abrams Apr 11 '12 at 16:06
Ah... good point on the double colon. You're right about that. Modern rsync uses ssh, but I think older ones used rsh by default. I remember having to set RSYNC_RSH (and continue doing it out of habit and/or legacy bash startup files). – Doug Harris Apr 11 '12 at 16:24
I've tried using -e ssh option but still got the same error.:( – SpawnST Apr 12 '12 at 2:01

Sometimes, those rsync error codes are due to different versions of rsync between the client and server, can you check the version number of both ?

  • What OS are you using both on the client and the server machine ?
share|improve this answer
All my servers are using CentOS release 5.2,and the rsync --version shows rsync version 2.6.8 protocol version 29. – SpawnST Apr 12 '12 at 1:58
My CentOS 5.8 servers shows rsync-3.0.6-4, so you are using an old version. I remember that rsync is one of the first things I need to update when the server was installed and the error message was similar as yours. Just to be sure, I would recommend update the openssh package as well. (yum update openssh rsync) – jhcaiced Apr 13 '12 at 18:22

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.