Rsync and Preservation of Ownership and Permissions

Michael Sierchio kudzu at tenebras.com
Thu Nov 24 07:24:28 UTC 2011


On Wed, Nov 23, 2011 at 9:01 PM, Martin McCormick
<martin at dc.cis.okstate.edu> wrote:
>        Rsync is a great utility, but is there a way to preserve
> ownership and permissions if rsync remotely logs in to a backup
> server as a normal user?

Does the same user exist on the remote system, with the same uid, etc.?

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...

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" ?

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...


>        The recovery process is run by root but copies all the
> files from the backup server as a normal user and uses its root
> capabilities to restore them.
>
>        What happens now is that all the files end up owned by
> and in the group of the user ID that copied the information from
> the client to the server. That's obviously not too useful so I
> suspect there is a better way than trying to make a remote login
> to root from another system.
>
>        Basically, cron starts a backup as root on system A.
> System A makes a remote ssh connection using the -e flag to
> backups at server. The system trying to recover the files starts a
> rsync process as root which remotely connects to backups at server
> to retrieve the files.
>
>        In practice, the files come across but every last one of
> them is owned by and in the group of user backups.
>
>        Any ideas are greatly appreciated.
>
> Thank you.
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>


More information about the freebsd-questions mailing list