On Tue 03 Aug 2021, Chris Green via rsync 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?
Best way is to run an rsync daemon on the source system, and be sure to use "uid = 0" so that the daemon reads the source as root. > 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. Hmm I prefer to use "pull" mechanisms as that's more secure (harder to screw up the destination). So create a /etc/rsyncd.conf file with the appropriate config, something like: [etc] path = /etc read only = yes hosts allow = another-system uid = 0 If using systemd then enable and start the daemon: systemctl enable rsync.service systemctl start rsync.service Then on another-system as root run rsync: rsync -a one-system::etc/ /backups/etc/ I usually also use -H for hard links, but /etc usually won't have those. You can also use an rsync password to make this a bit more secure so that not everyone on another-system can read all of /etc from one-system. Details in the manpage. Paul -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html