默认已安装rsync,rsync服务默认不是启动的

#打开vi /etc/default/rsync
RSYNC_ENABLE=true   #false改true

修改配置文件

cp /usr/share/doc/rsync/examples/rsyncd.conf /etc
pid file=/var/run/rsyncd.pid

设置密码

#vi /etc/rsyncd.secrets
rsyncuser:your_secure_password_123

chmod 600 /etc/rsyncd.secrets
chown root:root /etc/rsyncd.secrets

启动rsync服务

systemctl enable --now rsync

systemctl status rsync

如果未自动启动,手动运行:
rsync --daemon --config=/etc/rsyncd.conf