How to manage root<-->root rsync keeping permissions?

Chris Green
Tue, 03 Aug 2021 08:48:37 -0000

Is there a way to copy (for example) the /etc hierarchy from one
system to another preserving root ownership of files and without
revealing root passwords all over the place?

This is actually from and to Debian based systems (from Raspberry Pi
to Xubuntu) so there's no actual root user login anyway, it's all sudo
from privileged user.

So, it's easy for the sending end to be run as root as it's going to be
run by a script in /etc/cron.daily, so it can access all the files in
/etc even if only readable by root.

But how do you handle the other end to restore the root ownership etc.?
The script has to do something like:-

    rsync -a /etc/ chris at remote:backups/etc/

So at the remote end it only has chris' privileges.


I want to automate this, I don't want any manual intervention to be
needed.

--
Chris Green
?