We have moved to a new Sailfish OS Forum. Please start new discussions there.
1

rsync daemon mode as a systemd socket listener

asked 2014-01-25 01:46:14 +0200

gcobb gravatar image

Does anyone have a suitable systemd .socket file to run rsync as root in daemon mode when a connection is made?

I realise I can use rsync over ssh but I would like to run rsync as root so I can use it to backup important system directories as well as /home/nemo. The way I have all my other devices set up is to run rsync as daemon from inetd but on sailfish the preferred option seems to be to use a systemd .socket definition.

If no one has one, I will look at the systemd documentation and create one. But I thought someone might have already set this up.

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
2

answered 2014-01-27 22:28:11 +0200

gcobb gravatar image

updated 2014-01-27 22:31:33 +0200

I have created the required files myself, and they seem to work. All the instructions below should be run as root...

Create /etc/systemd/system/rsyncd.socket:

[Unit]
Description=Rsync Server Activation Socket
ConditionPathExists=/etc/rsyncd.conf

[Socket]
ListenStream=873
Accept=true

[Install]
WantedBy=sockets.target

Create /etc/systemd/system/rsyncd@.service:

[Unit]
Description=Rsync Server
After=local-fs.target
ConditionPathExists=/etc/rsyncd.conf

[Service]
# Note: this requires /etc/rsyncd.conf
ExecStart=/usr/bin/rsync --daemon
StandardInput=socket

Before you can use these, you need to also create /etc/rsyncd.conf. That is an exercise for the reader.

You can start rsyncd when you need it using:

systemctl start rsyncd.socket

Test that it has started correctly using:

rsync localhost::

It would be nice if these systemctl files could be added to the rsync package.

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
3 followers

Stats

Asked: 2014-01-25 01:46:14 +0200

Seen: 3,984 times

Last updated: Jan 27 '14