LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > 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
  Search this Thread
Old 03-30-2007, 08:08 AM   #1
Harlin
Member
 
Registered: Dec 2004
Location: Atlanta, GA U.S.
Distribution: I play with them all :-)
Posts: 316

Rep: Reputation: 38
Rsync changing owner of dirs


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
 
Old 03-30-2007, 01:11 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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]).
 
  


Reply



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 06:30 PM
Changing owner and group of file surfbass Linux - General 2 12-12-2005 02:25 PM
Changing owner of a directory recursively? fturcic Linux - General 2 02-01-2005 07:13 AM
Locking dirs so only the owner can access them colabus Linux - Newbie 2 08-14-2004 11:57 PM
apache, process owner, and rsync/ssh question Kruel Linux - Networking 0 03-01-2002 12:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration