1

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.

  • 1
    One of the reasons to build WSL into Windows was so that users would be able to download and run pre-built Docker containers off the Docker hub right away. So why not just try it, set up docker and load one of the rsync-servers off the hub? – the-wabbit Oct 17 '17 at 14:47
  • possible duplicate askubuntu.com/questions/914551/… – Mr. Raspberry Oct 17 '17 at 15:58
  • I am a linux user, but naive when it comes to Windows. Haven't heard of Docker, alas. Will investigate. And on the askubuntu answer, it appears that there must be some additional rsync under WSL config going on that isn't mentioned to get the windows-side rsync to listen, yes? – Torfey Oct 17 '17 at 17:00
1

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 and secrets.

The conf file:

auth users = nas
secrets file = /home/peter/rsyncd/secrets
hosts allow = 192.168.1.5,192.168.1.11
log file = /home/peter/rsyncd/rsyncd.log
port = 8730
use chroot = false
read only = false

[N_Almacen]
    path = /mnt/n/Almacen/rsyncd

[N_AlmacenNB]
    path = /mnt/n/AlmacenNB/rsyncd

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

enter image description here

Now you can put this shortcut in the startup folder for your user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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