rsync backup permissions

Matt McCutchen matt at mattmccutchen.net
Thu Oct 9 16:24:40 GMT 2008


On Thu, 2008-10-09 at 14:38 +0100, michael wrote:
> On Thu, 2008-10-09 at 14:17 +0100, michael wrote:
> > I wish to use rsync to backup users' home dirs from machineA (Debian) to
> > machineB (Fedora). I have a script, say backup.sh, in my own home dir
> > and linked to from /etc/cron.daily and have set up the ssh keys so
> > root at machineA can rsync to localUser at machineB. In testing the script is
> > run and files are transferred. However, they are owned by localUser (of
> > machineB) not of each user on machineA.

> I should add that I've also tried these flags:
> 
>   rsync --super -o -g --perms -z --partial -v --recursive --stats
> --times --links --exclude-from=${LOCAL_DIR}/.rsync-EXCLUDE
> --timeout=1800 ${LOCAL_DIR} ${REMOTE_LOGIN}:${REMOTE_DIR}
> 
> but get errors such as 
> rsync: chown <remoteDrive>/<username>/<file> failed: Operation not
> permitted (1)

-o is the option you want, but the receiving rsync needs to run as root
to be able to set the file ownership.  Alternatively, you could use
--fake-super, which does not set the real ownership but saves the
ownership data in an extended attribute from which a later rsync run can
retrieve it.

Matt



More information about the rsync mailing list