Chris Green via rsync <rsync at lists.samba.org> wrote:> 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. >If I used the --super option (in a command like the one above) and chris can run rsync as root on the remote end (via options in the sudoers file) will this do what I want? I guess I can go away and try it! :-) -- Chris Green ?
Hi Chris, On Tue, Aug 03, 2021 at 11:48:31AM +0100, Chris Green via rsync wrote:> If I used the --super option (in a command like the one above) and > chris can run rsync as root on the remote end (via options in the > sudoers file) will this do what I want? I guess I can go away and try > it! :-)You don't need --super if the remote side actually is running as root (either because you logged in as "root" or you logged in as "chris" but told it to execute "sudo rsync"). If you're going to use sudo then you'll want to set it NOPASSWD so it doesn't ask for a sudo password. Possibly restricting that only to uses of rsync or a specific script, otherwise it is giving "chris" blanket sudo access without a password. Cheers, Andy