Rsync group ownership using modules

OK, I have a client (booker) and server (fourroses).
I want to run a script on booker that uses rsync to copy files to fourroses and keep all user and group ownership attributes the same.

I have had success maintaining file attributes running rsync in regular instead of daemon mode. But I need this to run as a script (ultimately a cron job) and so the rsync command needs the '[FONT=Courier New]--password-file[/FONT]' option which can only be used when running rsync in daemon (i.e. '::') mode.
  • Both machines are on the same LAN.
  • I have root access on both machines.
  • My user (wyatt) is present on both machines and even has the same user and home group ids on both machines.
  • The rsync daemon is running on the server.
The server's /usr/local/etc/rsync/rsyncd.conf looks like this:

log file = /var/log/rsyncd.log

uid = wyatt
gid = wyatt

path = /shares/
read only = no
list = yes
auth users = wyatt
secrets file = /home/wyatt/scripts/pw.txt

The command in the script that is run from the client machine is:

rsync -rlpgotvO --delete --password-file=/home/wyatt/scripts/pw.txt /shares/ wyatt@fourroses.whiskey::bookermirror

Is there something I can change to maintain user and group ownership after the transfer?
You're running the rsync daemon as a regular user, and only root can chown files. You might need to set up mirrored users on both machines, then run a replication script via ssh as that user (for each user) to the target machine.
Jeckt: Do you write that I am running the rsync daemon as a regular user because of the 'uid' and 'gid' references in the /usr/local/etc/rsync/rsyncd.conf file? I actually started the rsync daemon on fourroses manually as root.
Also, I tried changing the 'uid' and 'gid' references to 'root' but it was not allowed. (I don't recall the precise error).

Also, I am not clear on your recommendation. Are you saying that I need a rsync command for each each user that owns files in /shares on booker?
Actually I might be mistaken. The gid/uid does enforce permissions like that of the user it's set to. You can test this by setting a permissions on a file so the rsync user can't read it, and the transfer of that file will fail. However the man page for rsyncd.conf says you can set something like:
for a module. I don't have experience using this option, but this looks like what you want. Some rsync options are a little convoluted, so you may want to study the man page to get the right combination.