Rsync not mapping user/group

Not sure if this is the right place to ask. Maybe it is a problem with the old rsync on CentOS 6.

I am trying to migrate a webserver from a CentOS 6 to a new RockyLinux server.
I have migrated over the passwd/group/shadow data (only for uid/gid >= 500) and added the value 500 to uid/gid to comply with user uid/gid >= 1000 on Centos 8/RockyLinux. For example userA was gid/uid 501/502 now it has 1001/1002. pwck and groupck does not show problems. getent passwd/group show correct result when used.

I started an ‘rsync --daemon’ (configured a module ‘www’ that points to the webfolders) on the old server and do a copy from the new server with ‘rsync -av --delete IPofOldserver::www/ /var/www/’.

But on the new server, files are created with the old uid/gid from the old machine.
As I remember, the ‘-a’ option of rsync includes the ‘-o -g’ options to map uid/gid on the new machine, depending on username/groupname, not uid/gid?

Has anybody an idea what is not working here?


I usually use rsync without daemon (i.e. via ssh). Could that work for you?

Yes, rsync daemon was the problem. Using ssh works as expected! Could have tried myself before asking :smirk:. Sorry for the noise.

Thank you very much.

Could have been something in /etc/rsyncd.conf if you had this prepared with configuration. Rsync over ssh will be slower due to the encryption but will work every time since it doesn’t require the rsync daemon or a working configuration in rsyncd.conf. So if your data isn’t confidential, and you require faster transfer rates, then the appropriate configuration for the rsync daemon will be better than via ssh.

A migration sounds like one-time operation, where cost of optimization vs its benefit is different than in, say hourly mirror synch of Rocky repos …

The point I made is still valid. Creating an rsyncd.conf file takes 1 - 2 minutes, whereas the benefits for migrating a lot of data is huge. Even if it is a one-time operation.

1 Like

I did the first big transfer over the rsync daemon, because as iwalker said, it is a lot faster. The second pass I did over rsync/ssh, where it applied the correct uid/gid of the files on the destination server.

1 Like

I use rsync with a config like this:

        path = /var/www/downloads
        comment = Downloads
        uid = root
        gid = root
        auth users = ian
        read only = no
        list = yes
        secrets file = /etc/rsyncd.secret

now obviously if I use rsync with the -a parameter, then the files I upload, irrespective of uid/gid being root in the rsyncd.conf, it will always show “ian” as the user against it. If I upload them without using -a, so for example:

rsync webserver::downloads

then it should obtain the uid/gid values as per the rsyncd.conf. At least it does for me anyway. The auth user, is just so that I need to provide a password as per the secrets file, but that depends on whether you feel you need it or not. I expect it could be additional parameters passed to rsync during the copy that was causing the issue maybe?