I tried:

rsync -v -v -e 'ssh -p YY' ./testfile me@XXXXX:/home

Error Message

opening connection using: ssh -p YY -l me 146.6.84.206 rsync ->-server -vvve.s . /home 
[sender] make_file(testfile,*,0)
send_file_list done
send_files starting
server_recv(2) starting pid=17537
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(600)[sender=3.0.6]
_exit_cleanup(code=12, file=io.c, line=600): about to call exit(12)

This works fine:

ssh -p YY me@XXXXX

Which suggests to me the problem is neither that sshd is not running nor that port YY is firewalled. I have checked anyway.

What other problems could there be?

EDIT: The problem seems to have been "self resolving." I could not replicate the following day. I started my local computer up. Perhaps notably I had a different IP address than last time. And now rsync magically works. I'd appreciate guesses as to what it could have been in light of it going away.

  • 1
    Do you have write permission at /home of the remote server? – souravc May 18 '15 at 3:53
  • Sure. When I ssh I can start doing cat and touch etc. On second thought I' not sure what you mean by remote. I'm talking about calling rsync while on a remote server to move things locally. I should have write permissions in both the original and destination folder – user3391229 May 18 '15 at 22:07
up vote 64 down vote accepted

You can also get this error if you specify a remote path that doesn't exist.

I got this error on OS X:

$ rsync -avz public/ static:apps/myapp.com
building file list ... done
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/io.c(453) [sender=2.6.9]

Turned it was simply a matter of mistyping the destination path. The apps dir didn't exist. When I changed that to static:sites/myapp.com instead (the sites dir did exist), the error went away.

It's fine if the final directory in the path doesn't exist (I could do static:sites/mynewapp.com) but it appears any preceding directory must already exist.

  • I've almost forgotten asking this question. I haven't had the same problem since. I suspect that this is what happened. – user3391229 Jan 6 '16 at 20:03
  • 12
    Thank you! That must be the most misleading error message ever. – Frans May 25 '16 at 18:12
  • also if you don't have rsync executable, it shows similar error. Mostly I have seen in ansibles – mannoj Nov 18 '16 at 6:13
  • For some reason I thought rsync would create the directory if it didn't exist... I guess not - you need to create the destination directory first. If the destination path ends in a slash the directory must exist. If it does not end in a slash, the one level above it must exist. – squarecandy Aug 6 '17 at 20:22
  • I had permission related problem on my remove server... – Chirag Purohit Apr 24 at 13:53

I got this error when rsync wasn't installed on the target host. The error message in my case also said rsync: command not found. A simple

sudo apt-get install rsync

on the target host solved the problem.

Does your login script at the remote end produce garbage on stdout? Check this with

ssh -p YY me@XXXXX /bin/true > out.txt

If out.txt contains data, identify the offending statements in your .profile or .bashrc and wrap them in

if [ ! -t 1 ]; then
  echo garbage
fi
  • Nada in out.txt. But I also tried that this afternoon during a period where I could not reproduce problem. – user3391229 May 18 '15 at 22:04
  • I tried this at a time when I could produce the problem and I also got nothing in out.txt. – joshreesjones Oct 14 '15 at 15:12

You may need to put in the full path to the ssh binary, ie

rsync -v -v -e '/usr/bin/ssh -p YY' ./testfile me@XXXXX:/home

Though there are other possible causes.

  • Yeah I read that could happen when you have multiple instances of ssh that you could be referencing. However, the fact that it went away the next day makes this unlikely – user3391229 May 18 '15 at 22:05

This error can also happen if the path to rsync at the remote system is not what the local system assumes it to be. You can see what is happening by specifying -vv (or even more vs). If this is the problem you can specify the remote path to rsync with the --rsync-path option.

I was seeing this error:

rsync -e 'ssh -v'

debug1: Exit status 11

...

rsync error: error in rsync protocol data stream (code 12) at /BuildRoot
/Library/Caches/com.apple.xbs/Sources/rsync/rsync-51/rsync/io.c(453)
[sender=2.6.9]

I was able to ssh into the remote host and found that it was out of disk space.

protected by Community Nov 26 '17 at 19:41

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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