LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
Thread Tools
Old 03-30-2007, 09:08 AM   #1
Harlin
Member
 
Registered: Dec 2004
Location: U.S.
Distribution: Slackware -- It is like... my life
Posts: 303
Thanked: 0
Rsync changing owner of dirs


[Log in to get rid of this advertisement]
Not sure if this is an rsync issue or a weird Redhat security issue. I have 2 groups. GroupA and GroupB. I have a file structure like this... /GroupADir and /GroupADir/GroupBDir... /GroupADir is owned by groupa:groupa. The /GroupADir/GroupBDir is owned by groupb:groupb. GroupA is a member of GroupB. When I run rsync I am using the groupa account as my ssh account when i do this. When running rsync, GroupA gets all of the files with no problems from both directories. However, after finishing rsync, the /GroupADir/GroupBDir is now mysteriously and recursively owned by groupa:groupa instead of the original groupb:groupb. Is there any way to keep this from happening after rsync is run?

Rsync looks like this...
cmd = 'rsync --verbose --progress --stats --compress --rsh=/usr/bin/ssh --recursive --times --perms --links --delete $hostName:'+sys.argv[1]+' '+sys.argv[2]

Thanks,

Harlin Seritt
Harlin is offline     Reply With Quote
Old 03-30-2007, 02:11 PM   #2
jlightner
Senior Member
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 3,548
Thanked: 145
rsync does have flags that deal with ownership and permissions.

However the most obvious possibility would be that you have different UIDs for groupa/groupb on the two boxes. The files are actually stored with the UID (User Identity = Numeric) as opposed to the User name (Alpha). When you use commands such as ls to list files it does a lookup in /etc/passwd to convert the UID to the name.

So if on hosta you had groupa with UID 500 but on hostb you groupa with UID 501 and groupb with UID 500 then the files that ls would find as NAME groupa on hosta would be NAME groupb on hostb but would be UID 500 on both.

You can determine UID by doing a grep for the user name from /etc/passwd:
e.g.:
grep jlightne /etc/passwd
jlightne:x:515:500:Jeff Lightner:/home/jlightne:/bin/ksh

The 3rd field is the UID which is 515 for the example. (The fourth field is the GID [Group ID]).
jlightner is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Owner sghod1212 Mandriva 1 12-19-2005 07:30 PM
Changing owner and group of file surfbass Linux - General 2 12-12-2005 03:25 PM
Changing owner of a directory recursively? fturcic Linux - General 2 02-01-2005 08:13 AM
Locking dirs so only the owner can access them colabus Linux - Newbie 2 08-15-2004 12:57 AM
apache, process owner, and rsync/ssh question Kruel Linux - Networking 0 03-01-2002 01:25 PM


All times are GMT -5. The time now is 04:37 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration