how to enable rsync daemon on ubuntu
I run ubuntu 22.04 OS which has rsync installed as backup server.
How to enable it as a service which should be started up at system reboot?
After 'atp install rsync', I have to create the config file for rsync server. The config is located at /etc/rsyncd.conf. You should have this file existing to let rsync start up as a daemon.
sudo vi /etc/rsyncd.conf # save and close it
sudo cp /lib/systemd/system/rsync.service /etc/systemd/system/rsync.service
Now you can start it by manual,
sudo systemctl start rsync
But if you want to make it live after system reboot, you should enable it as a systemd service.
sudo systemctl enable rsync
And you maybe want to edit the file '/etc/default/rsync' (it's based on your startup way) and setup this line:
RSYNC_ENABLE=true
Now reboot the OS, and you will see rsync startup as the daemon listening on port 873.
$ sudo netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 833/rsync
Here are the content of my rsyncd.conf,
use chroot = yes
max connections = 4
syslog facility = local5
pid file = /var/run/rsyncd.pid
[VPS]
uid = nobody
gid = nobody
hosts allow = xx.xx.xx.xx yy.yy.yy.yy
hosts deny = *
path = /data/rsync
comment = remote backup
read only = no
[MAC]
uid = nobody
gid = nobody
path = /data/rsync
comment = backup for mac
auth users = authUser
read only = no
secrets file = /etc/rsyncd.secrets