Hi, I am using openrsync to backup some directory trees locally to a separate mount point, using -a flag, which should preserve file and directory ownership provided rsync is run as root.
I noticed directory ownerships are not as expected in backup location (/tmp for the purpose of this demonstration), as opposed to file ownerships, which are correct. I tested on multiple systems, 6.8 and 6.9, and I can always reproduce it as follows: - create the following directory and file structure in user's home: /home/user/dir1/file1.txt /home/user/dir1/dir2/file2.txt /home/user/dir1/dir2/dir3/file3.txt By default, they are all owned by user (check with ls -lR): /home/user/dir1: total 8 drwxr-xr-x 3 user user 512 Jun 7 11:28 dir2 -rw-r--r-- 1 user user 8 Jun 7 11:28 file1.txt /home/user/dir1/dir2: total 8 drwxr-xr-x 2 user user 512 Jun 7 11:34 dir3 -rw-r--r-- 1 user user 10 Jun 7 11:28 file2.txt /home/user/dir1/dir2/dir3: total 4 -rw-r--r-- 1 user user 13 Jun 7 11:34 file3.txt - now, as root, using -a flag, sync /home/user/dir1 to /tmp/: openrsync --rsync-path=/usr/bin/openrsync -a /home/user/dir1 /tmp/ - check (perhaps with ls -lR) file and directory ownership: /tmp/dir1: total 4 drwxr-xr-x 3 root wheel 512 Jun 7 11:28 dir2 -rw-r--r-- 1 user user 8 Jun 7 11:28 file1.txt /tmp/dir1/dir2: total 4 drwxr-xr-x 2 root wheel 512 Jun 7 11:34 dir3 -rw-r--r-- 1 user user 10 Jun 7 11:28 file2.txt /tmp/dir1/dir2/dir3: total 2 -rw-r--r-- 1 user user 13 Jun 7 11:34 file3.txt Notice that files are correctly owned by user:user, but directories are owned by root:wheel, as opposed what manpage says about -a flag (shorthand for, among others -g and -o - preserve owner and group if run as root). Best regards, -- Before enlightenment - chop wood, draw water. After enlightenment - chop wood, draw water. Marko Cupać https://www.mimar.rs/

