You are not logged in.
Hi
I would like to use rsyncd to synchronize my laptop and desktop and vice-versa. Now I'm wondering what would be the best way to start rsyncd up.
The simplest would be to start it by rsyncd.service on both machines.
I read that it is possible to use xinetd to start it up on-demand. I don't have xinetd running and I don't think it makes sense to start it up for only this task.
I'm wondering if systemd could somehow start rsyncd up on-demand ? Or is this done when I use rsyncd.service ? I read that systemd can offer sockets to services and start them up when they are needed. However I don't really understand how this is working. If someone could enlighten me a bit on that matter or give me a link to a simple explanation.
I read man rsync and I know that there's the possibilty to use ssh for this.
Last edited by rebootl (2012-12-27 16:35:30)
Personal website: reboot.li
GitHub: github.com/rebootl
Offline
Start the rsyncd.socket rather than the service.
Offline
Hey, thanks for this tip, would be cool if I could get this working.
Unfortunately this gives me:
[cem@amd64box TEST]$ rsync -avu -P --delete files cem@hplaptop::home_cem/TEST/
@ERROR: failed to open lock file
rsync error: error starting client-server protocol (code 5) at main.c(1516) [sender=3.0.9]
While with rsyncd.service started it's working.
Here's my /etc/rsyncd.conf from the host I want to sync with (hplaptop in this case):
hosts allow = 192.168.0.<xxx>
hosts deny = *
uid = cem
gid = users
use chroot = no
max connections = 4
syslog facility = local5
pid file = /run/rsyncd.pid
read only = false
[home_cem]
path = /home/cem
comment = My personal home directory
I added:
lock file = /home/cem/rsyncd.lock
and also tried commenting out pid file but no luck yet...
Edit: Marked as solved. The trick with activating the socket instead of the service was what I was looking for. It works for sshd, maybe I'll go this way.
Last edited by rebootl (2012-12-20 16:05:16)
Personal website: reboot.li
GitHub: github.com/rebootl
Offline
Do you mean you got it working? If so, others will appreciate your explaining how!
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
I think that instead of trying to use xinetd with rsyncd, the OP decided to simply go with systemd's built in socket activation (ie. starting rsyncd.socket rather than rsyncd.service). I was confused at first as well, but I think the edit on the bottom is where the true solution lies.
Offline
Hi again
WonderWoofy is right.
Unfortunately starting rsyncd.socket gives me the error mentioned in the post above. Till now I did not find a solution to get this working. If someone has an idea on this, please tell.
I was unsure if I should mark it as solved or not. But then I decided to do so, because the basic question was how to start the service on-demand with systemd. Which was answered by starting the socket instead of the service. This I didn't know before. Since systemd can do this there's really no need to setup xinetd for this case.
By the edit I meant that starting sshd.socket instead of sshd.service works just out of the box (I can log-in). Since it's possible to use rsync through ssh I should be able to set it up this way. (Start sshd.socket on the host I want to push sync and tell rsync to use ssh.)
See (external link): www.yolinux.com/TUTORIALS/Rsync.html
The goal is not to have constantly running services, wich would be achieved by this (using sshd instead of rsyncd) I think.
I would still prefer to use rsyncd and maybe I'll give it another try this evening... One reason I'd prefer rsyncd is that I need a passwordless log-in, cause I want to script this, and I just found it the easiest way to get this. Of course ssh is more secure but I don't know, I don't feel the need to have this super security on my home LAN.
Regards
Edit: Okay, when using rsyncd.socket systemd uses /usr/lib/systemd/system/rsyncd@.service to start up the service on-demand. There User and Group are specified to be nobody. Changing this to root or my user (by copying the file to /etc/systemd/system/ and editing there of course;) makes it work w/o the above error...
Last edited by rebootl (2012-12-22 20:21:24)
Personal website: reboot.li
GitHub: github.com/rebootl
Offline
You can also create the file manualy and change it's owner to nobody:nobody
sudo touch /var/run/rsyncd.lock
sudo chown nobody:nobody /var/run/rsyncd.lock
Offline