Is it possible using the Windows 10 Windows Subsystem for Linux (WSL) to have a rsync server running on a Windows box?
We have a linux rsync system that polls Windows boxes currently running DeltaCopy, but we occasionally have odd problems. Hoping that the 'built-in' WSL rsync might improve things, but don't know how to arrange to have it run as a server.
Best Answer
I've managed to have it working on my system. It's not exactly a daemon in the sense of a Windows service but more of a background task of the current user, but it works for me.
Installation and initial configuration
I installed WSL for my user and Debian as the linux application of choice. Anyway it should work with any distribution as it only uses
rsync
.On my linux home directory I've created two files:
rsyncd.conf
andsecrets
.The conf file:
I'm using port 8730 to avoid having to run the daemon as root. That's also the reason I've disabled chroot.
The secrets file contains usernames and passwords as usual.
How to run it
Finally the tricky part. How to run it?
You can test it with this command:
rsync --daemon --config=/home/peter/rsyncd/rsyncd.conf --no-detach
When you are confident that the configuration is working you can remove the
--no-detach
option and the command will spawn a background task. Even if you close all bash terminals the task will remain in the background.How to start it automatically in the background
So now how to run automatically on login?
Create a windows shortcut to
C:\Windows\System32\wsl.exe
and append your command after that. The full command will be:C:\Windows\System32\wsl.exe rsync --daemon --config=/home/peter/rsyncd/rsyncd.conf
Now you can put this shortcut in the startup folder for your user.