Different results depending on the user launching rsync
matt at mattmccutchen.net
Mon Dec 10 18:03:17 GMT 2007
On Mon, 2007-12-10 at 14:32 +0100, Eduardo Juan wrote:
> Exactly the same command shows different rsync results depending on the
> user executing the rsync.
> If I execute rsync as root I get a proper result but if I execute as
> user_x there seems to be many files that require updating.
> Here is the command I execute
> /opt/local/bin/rsync -avuzhn --relative -e ssh
> xt --rsync-path=/opt/local/bin/rsync /sea_bete_disk/LMI_IRELAND/
The difference probably occurs because your destination is given as the
remote user's home directory and (by default) ssh logs in as the remote
user with the same name as the local user. Naturally, if root and
user_x have different home directories on seaserv1lmi , the command will
put the files in different places. If you want the same behavior
regardless of the local user, either specify the remote user by
prepending USER@ to the seaserv1lmi: or append an absolute destination
path to the seaserv1lmi: .
> The only explanation I can find is that when I execute as user_x all the
> files on the destination directory will have the owner changed to the
> user executing rsync. If this is so is there a way avoid it and preserve
> file ownership.
This is another issue. Most operating systems will not let a non-root
receiving user set file ownership arbitrarily, so the receiving rsync
will not try to preserve ownership unless it is running as root. If you
want ownership preserved, either run the receiver as root or obtain a
copy of rsync that supports --fake-super and use that option.
More information about the rsync