Rsync - Preserve owner/group with different UID/GID | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Rsync - Preserve owner/group with different UID/GID

Shell Programming and Scripting


Tags
rsync, tar command

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-30-2007
Santi Santi is offline
Registered User
 
Join Date: Jan 2006
Last Activity: 2 April 2009, 5:45 PM EDT
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Rsync - Preserve owner/group with different UID/GID

Dear Folks :-)

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:


Code:
# 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:


Code:
# 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:


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

Regards,

--
Santi Saez
Sponsored Links
    #2  
Old 12-02-2007
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
 
Join Date: Nov 2007
Last Activity: 27 October 2014, 10:04 PM EDT
Location: New Zealand
Posts: 1,044
Thanks: 21
Thanked 26 Times in 25 Posts
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.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Setting group and owner with mkdir? moose123 UNIX for Dummies Questions & Answers 1 07-20-2011 11:34 AM
preserve timestamp of symlinks using rsync KiranKumarKarre Shell Programming and Scripting 1 06-18-2009 11:24 AM
automatically change owner and group borderblaster Shell Programming and Scripting 1 04-24-2009 08:11 AM
permission, owner and group pascalbout Shell Programming and Scripting 2 01-14-2006 11:47 AM
owner and group in Linux lapnguyen UNIX for Dummies Questions & Answers 1 07-16-2002 11:55 AM



All times are GMT -4. The time now is 12:14 PM.