Server
Add user & group
groupadd rsync
useradd rsync -g rsync -s /sbin/nologin
vim /etc/rsyncd.conf
-----
read only = no
use chroot = yes
uid = srv
gid = lxfiles
pid file=/var/run/rsyncd.pid
log file=/var/log/rsyncd.log
[examplemodule]
secrets file = /etc/rsyncd.secrets
auth users = srv
path = /home/srv/
-----
vim /etc/rsyncd.secrets
-----
rsync:<your-password>
-----
chmod 600 /etc/rsyncd.secrets
Daemon start
rsync --daemon --config=/etc/rsyncd.conf
Client
Create password file
echo "<your-password>" > /etc/rsyncd.passwd
chmod 600 /etc/rsyncd.passwd
Sync
Local to remote
rsync -av --password-file=/etc/rsyncd.passwd /path/to/local/folder/ suling@192.168.123.100::examplemodule
Remote to local
rsync -av --password-file=/etc/rsyncd.passwd suling@192.168.123.100::examplemodule/ /path/to/local/folder/
Log
rsync -av --password-file=/data/ssh/root/.secrets/rsyncd.passwd /storage/emulated/0/DCIM/ suling@192.168.123.100::DCIM > /sdcard/Android/.logs/`date "+%Y-%m-%d-%H-%M"`_rsync_DCIM.log 2>&1