Bug 1226656

Summary: rsync --chown sets permissions to root:root after upgrade to Leap 15.6
Product: [openSUSE] openSUSE Distribution Reporter: Georg Pfuetzenreuter <georg.pfuetzenreuter>
Component: NetworkAssignee: David Anes <david.anes>
Status: IN_PROGRESS --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: suse-beta
Version: Leap 15.6   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Georg Pfuetzenreuter 2024-06-20 16:46:43 UTC
Hi,

On the client:

```
rsync -a --delete --super --owner --group --chown=477:479 --chmod='u=rwX,g=rX,o=' $PWD/ rsync://saltpush@witch1.infra.opensuse.org:873/salt-push/
```

On the server, rsyncd.socket is listening with the following /etc/rsyncd.conf:

```
# Salt managed defaults

address = ::
gid = users
log format = %h %o %f %l %b
secrets file = /etc/rsyncd.secrets
transfer logging = True
use chroot = True

# Salt managed modules

[salt-push]
    path = /srv/salt-git/
    comment = /srv/salt-git/
    list = false
    uid = root
    gid = salt
    auth users = saltpush
    read only = False
    hosts allow = 2a07:de40:b27e:1203::126, 2a07:de40:b27e:1203::127
```

With Leap 15.5, sync operations would keep the expected permissions and ownership on the directory /srv/salt-git and its contents.

After the upgrade to Leap 15.6, which installed `rsync-3.2.7-150600.1.5.x86_64` on both the client and server side, the following happens:

```
root@witch1 ~# chown -R 477:479 /srv/salt-git
root@witch1 ~# ls -dn /srv/salt-git
drwxr-x--- 1 477 479 426 Jun 20 16:35 /srv/salt-git/

8ec7287bf746:/srv/salt-git # rsync -a --delete --owner --group --chown=477:479 --chmod='u=rwX,g=rX,o=' $PWD/ rsync://saltpush@witch1.infra.opensuse.org:873/salt-push/

root@witch1 ~# ls -dn /srv/salt-git
drwxr-x--- 1 0 0 426 Jun 20 16:35 /srv/salt-git/
```

The directory gets recursively owned as root:root instead of keeping 477:479.
Comment 1 David Anes 2024-06-21 09:31:29 UTC
Hi Georg,

Does this happen if you use latest version 3.3.0 from network project in OBS?

https://download.opensuse.org/repositories/network/15.6/x86_64/rsync-3.3.0-lp156.165.1.x86_64.rpm
Comment 2 Georg Pfuetzenreuter 2024-06-21 12:27:35 UTC
Hi David,

thanks for getting back. I installed the you linked on both the client and server, but the behavior unfortunately is still the same.
Comment 3 David Anes 2024-06-21 14:19:06 UTC
Hi Georg,

can you try adding `--numeric-ids` flags (as you are using `--chown=477:479`)? Also, are you running rsync as root?
Comment 4 Georg Pfuetzenreuter 2024-06-21 14:34:25 UTC
I already tried using `--numeric-ids`, it did not help  - on the client side, rsync is running as root - on the server side, rsyncd is initiated as root by the systemd socket, and the module is configured with "uid root" as well.
Comment 5 David Anes 2024-07-01 14:43:48 UTC
I cannot reproduce the issue, I think we are missing something.

Can you try passing --super to the remote (-M--super) and see if it works (or removing it altogether, as you are root on both ends?).
Comment 6 Georg Pfuetzenreuter 2024-07-04 13:34:02 UTC
Thanks for investigating. The result is the same with these command lines:

```
# rsync -a --delete --owner --group --chown=477:479 --chmod='u=rwX,g=rX,o=' $PWD/ rsync://saltpush@witch1.infra.opensuse.org:873/salt-push/

# rsync -a --delete -M--super --super --owner --group --chown=477:479 --chmod='u=rwX,g=rX,o=' $PWD/ rsync://saltpush@witch1.infra.opensuse.org:873/salt-push/
```

Both with and without the target directory previously manually chown-d.

I now found out that the behavior also exists when calling rsync on a 15.6 client towards a 15.5 server.