Why is this rsync connection unexpectedly closed on Windows?

WindowsRsync

Windows Problem Overview


I'm trying to use rsync on Windows 7. I installed cwRsync and tried to connect to Ubuntu 9.04.

$ rsync -azC --force --more-options ./ user@server:/my/path/
rsync: connection unexpectedly closed (0 bytes received so far) [receiver] 
rsync error: error in rsync protocol data stream (code 12) at io.c(600) [receiver=3.0.5]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(610) [sender=3.0.8]

Windows Solutions


Solution 1 - Windows

The trick for me was I had ssh conflict.

I have Git installed on my Windows path, which includes ssh. cwrsync also installs ssh.

The trick is to have make a batch file to set the correct paths:

rsync.bat

@echo off
SETLOCAL
SET CWRSYNCHOME=c:\commands\cwrsync
SET HOME=c:\Users\Petah\
SET CWOLDPATH=%PATH%
SET PATH=%CWRSYNCHOME%\bin;%PATH%
%~dp0\cwrsync\bin\rsync.exe %*

On Windows you can type where ssh to check if this is an issue. You will get something like this:

where ssh
C:\Program Files (x86)\Git\bin\ssh.exe
C:\Program Files\cwRsync\ssh.exe

Solution 2 - Windows

I saw this when changing rsync versions. In the older version, it worked to say:

rsync -e 'ssh ...

when the rsync.exe and ssh.exe were in the same directory.

With the newer version, I had to specify the path:

rsync -e './ssh ...

and it worked.

Solution 3 - Windows

I had this problem, but only when I tried to rsync from a Linux (RH) server to a Solaris server. My fix was to make sure rsync had the same path on both boxes, and that the ownership of rsync was the same.

On the linux box, rsync path was /usr/bin, on Solaris box it was /usr/local/bin. So, on the Solaris box I did ln -s /usr/local/bin/rsync /usr/bin/rsync.

I still had the same problem, and noticed ownership differences. On linux it was root:root, on solaris it was bin:bin. Changing solaris to root:root fixed it.

Solution 4 - Windows

I had this error coming up between 2 Linux boxes. Easily solved by installing RSYNC on the remote box as well as the local one.

Solution 5 - Windows

This error message probably means that you either mistyped the server name or forgot to start an ssh server at server. Make absolutely certain that an ssh server is running on the server at port 22, and that it's not firewalled. You can test that with ssh user@server.

Solution 6 - Windows

i get the solution. i've using cygwin and this is the problem the rsync command for Windows work only in windows shell and works in the windows powershell.

A few times it has happened the same error between two linux boxes. and appears to be by incompatible versions of rsync

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionrkmaxView Question on Stackoverflow
Solution 1 - WindowsPetahView Answer on Stackoverflow
Solution 2 - WindowsSeth WegnerView Answer on Stackoverflow
Solution 3 - WindowsMarkView Answer on Stackoverflow
Solution 4 - WindowsdavidgoView Answer on Stackoverflow
Solution 5 - WindowsphihagView Answer on Stackoverflow
Solution 6 - WindowsrkmaxView Answer on Stackoverflow