Rsync – use another user in “uid” than root

rsyncsynology

I'm trying to define a RSync Backup Job in Hyper Backup of Synology DS to backup my files from Synology DS to a Linux Server running Ubunut 14.04.

Here is a copy of my rsync.conf file

use chroot = true
read only = false
uid = rsync-user
gid = rsync-user

transfer logging = true
log format = %h %o %f %l %b
log file = /var/log/rsyncd.log

[MyBackup]
path = /data/backup
comment = Backup directory
auth users = mysyncuser
secrets file = /etc/rsyncd.secrets

"rsync-user" is a local user on Linux Server who has login capabilities:

rsync-user:x:10001:10001::/home/rsync-user:/bin/bash

And is the OWNER of "/data/backup"

The Problem is once I trigger the Backup in Synology DS, the Server is not able to create the "BackupFolder" Folder under "/data/backup" and shows these messages:

2016/08/10 17:36:37 [29598] rsync on MyBackup/BackupFolder/synobkpinfo.db from mysyncuser@pD9FXXXXX.dip0.t-ipconnect.de (217.250.xxx.xx)
2016/08/10 17:36:37 [29598] building file list
2016/08/10 17:36:37 [29598] rsync: change_dir "/BackupFolder" (in MyBackup) failed: No such file or directory (2)
2016/08/10 19:36:38 [29599] connect from pD9FXXXXX.dip0.t-ipconnect.de (217.250.xxx.xx)
2016/08/10 17:36:38 [29599] rsync on MyBackup/BackupFolder from mysyncuser@pD9FXXXXX.dip0.t-ipconnect.de (217.250.xxx.xx)
2016/08/10 17:36:38 [29599] building file list
2016/08/10 17:36:38 [29599] rsync: link_stat "/BackupFolder" (in MyBackup) failed: No such file or directory (2)
2016/08/10 17:36:38 [29599] sent 101 bytes  received 26 bytes  total size 0

If I change the uid section to root, everything runs properly:

uid = root

Any help is highly appreciated.

Best Answer

You configure rsync with chroot. User rsync-user has home directory /home/rsync-user and has access there only (when chroot is enable). Add symbolic link at user's home directory to /data/backup directory:

ln -s /data/backup /home/rsync-user/backup

And change path to /home/rsync-user/backup

I think the log file /var/log/rsyncd.log must be changed the same way.