Rsync - Preserve owner/group with different UID/GID

Dear Folks :slight_smile:

I want to rsync some files between some servers and preserve files owner and group (not UID or GID), in some machines UID and GID are differents, for example:

a) In the rsync server:

# stat vbseo.php 
  File: `vbseo.php'
  Size: 26758           Blocks: 56         IO Block: 4096   regular file
Device: 804h/2052d      Inode: 21971712    Links: 1
Access: (0644/-rw-r--r--)  Uid: (10002/ user1)   Gid: (10001/  psacln)
Access: 2006-10-09 18:30:59.000000000 +0200
Modify: 2006-10-09 19:12:48.000000000 +0200
Change: 2006-10-09 19:12:48.000000000 +0200

# grep psacln /etc/group
psacln:x:10001:

b) In the rsync clients:

# stat vbseo.php 
  File: `vbseo.php'
  Size: 26758           Blocks: 56         IO Block: 4096   regular file
Device: 803h/2051d      Inode: 37421492    Links: 1
Access: (0644/-rw-r--r--)  Uid: (10002/ user1)   Gid: (10001/ UNKNOWN)
Access: 2007-11-30 10:46:59.000000000 +0100
Modify: 2006-10-09 19:12:48.000000000 +0200
Change: 2007-11-30 10:46:59.000000000 +0100

# grep psacln /etc/group
psacln:x:2524:

In the case of UID/GID are the same between machines there isn't problems.. but when don't match there are problems. I have tried several rsync options like "--owner", "--group", "--numeric-ids", "--super", etc.. but getting the same result.. is there anyway to make this with rsync?

I have a similar solution with tar+ssh but I want to use Rsync:

tar cpzf - /source --ignore-failed-read --ignore-zeros | ssh root@192.168.x.x -p22 "cd /destination; tar --same-owner -xzf -"

Regards,

--
Santi Saez

The mapping of username to UID (and groupname to GID) stays within the server. The only way to get the names in sync is to keep the UIDs in sync or to chown the files after doing the copy sorry.