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
On my linux home directory I've created two files:
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
path = /mnt/n/Almacen/rsyncd
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
Now you can put this shortcut in the startup folder for your user.