Skip to content

Rsync support #1266

@ceztko

Description

@ceztko

OpenSSH for Windows version
7.7.2.0 (both on client and server)

Server Operating System
Windows Server 2016 Datacenter 1607 14393.2515

Client Operating System
Windows 10 Pro 1803 17134.320

What is failing
One of the most useful use cases when using ssh transport is rsync file synchronization. rysnc is unfortunately one of the very useful utilities that didn't receive a native Win32 port, only cygwin/msys2 ports. These are self-contained in only 3 files:

  • rsync.exe
  • cygwin1.dll (or msys-2.0.dll);
  • cygiconv-2.dll (or msys-iconv-2.dll).

I attached the cygwin port here for convenience, but the files can be easily stripped from a cygwin or msys2 installation:
rsync-cygwin.zip

Rsync must be present on both client and server to allow file synchronization. Maybe unsurprisingly the cygwin/msys2 port of rsync doesn't work together Win32-OpenSSH on client side, but works very well on the server side, making it very interesting experiment!

Expected output

NOTE1: a cygwin/msys2 port of OpenSSH must be installed on client side!
NOTE2: a cygwin/msys2 port of rsync must be present on server side and visible in PATH!

The following works correctly client side when launched inside cygwin shell using cygwin OpenSSH port:

ceztko@laptopbbk ~
$ rsync -avz -e ssh /cygdrive/c/Test/ Administrator@remotehost:/cygdrive/c/Test/
Administrator@remotehost's password:
sending incremental file list
./
Test.txt

sent 147 bytes  received 38 bytes  10.57 bytes/sec
total size is 3  speedup is 0.02

Obviously having cygwin installed you can achieve the same from a regular command prompt:

C:\cygwin64\bin\bash --login -c "rsync -avz -e ssh /cygdrive/c/Test/ Administrator@remotehost:/cygdrive/c/Test/"

Actual output

NOTE: Win32-OpenSSH ssh.exe must be present on PATH

Forcing cygwin/msys2 port of rsync to use Win32-OpenSSH results in the following errors:

C:\Users\ceztko>rsync -avz -e ssh /cygdrive/d/Test/ Administrator@remotehost:/cygdrive/c/Test/
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [Receiver=3.1.2]
rsync: safe_read failed to read 4 bytes [sender]: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(276) [sender=3.1.2]

My guess is that this is happening because IPC communication between cygwin rsync and Win32-OpenSSH is not compatible. Questions:

  • Can this be addressed/fixed?
  • Alternatively, do you have plans to also port rsync natively to Win32?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions