Bug 8844 - rsyncd ownership handling
rsyncd ownership handling
Product: rsync
Classification: Unclassified
Component: core
All All
: P5 normal
: ---
Assigned To: Wayne Davison
Rsync QA Contact
Depends on:
  Show dependency treegraph
Reported: 2012-04-05 11:36 UTC by andras.porjesz
Modified: 2012-08-12 17:18 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description andras.porjesz 2012-04-05 11:36:21 UTC
I have an rsync client running with the following flags:
	RSYNC_FLAGS="--recursive"                      # this tells rsync to copy directories recursively
	RSYNC_FLAGS="$RSYNC_FLAGS --links"             # recreate symlinks
	RSYNC_FLAGS="$RSYNC_FLAGS --perms"             # set the destination permissions
	RSYNC_FLAGS="$RSYNC_FLAGS --times"             # transfer modification times along with the files
	RSYNC_FLAGS="$RSYNC_FLAGS --omit-dir-times"    # omit directories when it is preserving modification times
	RSYNC_FLAGS="$RSYNC_FLAGS --owner"             # set the owner of the destination file to be the same as the source
	                          # group is set to ossdes on the server side, so there is no option for that here
	RSYNC_FLAGS="$RSYNC_FLAGS --chmod=Dg+rw,Fg+r"  # set permissions     
#	RSYNC_FLAGS="$RSYNC_FLAGS -D"   	       # option is equivalent to --devices --specials - we do not need it
	RSYNC_FLAGS="$RSYNC_FLAGS --compress"          # compress file data during the transfer
	RSYNC_FLAGS="$RSYNC_FLAGS --relative"          # use relative paths
	RSYNC_FLAGS="$RSYNC_FLAGS --numeric-ids"       # transfer numeric group and user IDs
	RSYNC_FLAGS="$RSYNC_FLAGS --delete"            # delete extraneous files from the receiving side
	RSYNC_FLAGS="$RSYNC_FLAGS --stats"             # print a verbose set of statistics on the file transfer
        RSYNC_FLAGS="$RSYNC_FLAGS --human-readable -h" # output numbers in a human-readable format

I have an rsyncd (root:root) with the following setup:
comment = data area for rsync 
path = something
log file = /var/log/rsyncd.log
read only=false
write only=false
use chroot=true

rsync works as expected (at least does what I expect). when I comment out uid=root in rsyncd.conf the owner will not be transferred any more, it will remain nobody.

The precedence of --perms on the client side (including -o, -g) and the uid= guid= settings on the server side are unclear, not documented and as I wrote here depending on the settings rsync may even change its behavior.
Comment 1 Wayne Davison 2012-08-12 17:18:51 UTC
Taken from the rsyncd.conf manpage:

    This parameter specifies the user name or user ID that file transfers to and from that module should take place as when the daemon was run as root.

That is stated poorly in that it is trying to say that the process runs as that user.  The gid parameter is similar.  Both default to running the process as "nobody", which has no rights to chown files to other users.  So, if you want to preserve ownership, you must run the receiving process as root, or perhaps settle for fake-super storing ownership info as xattrs (which will only be useful for people reading the files via rsync).