Rsync and Preservation of Ownership and Permissions

Martin McCormick martin at dc.cis.okstate.edu
Thu Nov 24 14:05:34 UTC 2011


Michael Sierchio writes:
> Does the same user exist on the remote system, with the same uid, etc.?

Yes.

> If you're using rsync with ssh as the transport, and connecting to the
> remote machine as the backups user, that's who will own the files on
> its local filesystem...

I thought rsync had some encoding it might slip in to the tree
that another rsync run as root on the recovering system could
use to figure out all those thousands of ownerships and get them
all straight, but this makes perfect sense.
> You've written a lot of narrative, but show us precisely what commands
> you're running.  Why would you run the command as root, and ssh as
> backups, when you want them to be owned by "normal" ?

	Because root is the only user who can "see" files from
all other users so root starts the process. Here is what I
tried. Remember, folks, this will not work! This tries to backup
a system named z.

##!/bin/sh
#rsync --delete -alHvq --exclude "/proc" // backups at backup-server.okstate.edu:z

> You can run the command as root, and use restricted ssh keys (use
> authorized_keys to restrict it to executing a specific rsync
> command)....  you can run rsync as a regular user to that user's
> account on the remote system...

perryh at pluto.rain.com writes:
> Perhaps you could have rsync log in to a jail on the backup server,
> where it could safely be granted root permission.

Hmm. It's all rather clear, now. A jailed environment that looks
like root is about the only thing that could work.

	Thank you.


More information about the freebsd-questions mailing list