LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-28-2011, 02:21 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Rsync Not Retaining Permissions


I've got an older RHEL 5.5 server that we're using for our company email server. We're going to retire this server and I've created a new Debian Linux server as it's replacement. Now I'm trying to rsync all the users /home/ directories to the new server however when I tested this, I noticed a problem. In the old source server where I'm running the actual rsync command from, everyone's home directory is owned by their unique UID and a generic GID (100 = users). So when I execute this command on the old RHEL 5.5 server:

Code:
rsync -e ssh -avz /home/* root@192.168.0.101:/home
Why are all the users home directories being owned by root:root on the target server? It's not owned by root:root on RHEL 5.5 and the only thing I can think of is my rsync command is wrong. According to the man page, I can see that using the -a switch should preserve all file ownership and much more. It's not doing this on the target Debian server. If it tries to copy over /home/bob and it's owned by bob:users, if Debian didn't know or have a UID for Bob, wouldn't it just assign a UID from RHEL 5.5 to the Debian server? So like /hone/bob would be owned by 1009:users?

Anyone know what I'm doing wrong?
 
Old 01-28-2011, 02:59 PM   #2
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 3,491

Rep: Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541
rsync

Not sure I can help, as I have not been able to replicate this problem.
I may be able to make something clear, the '-a' option preserves ownership by UID, not by name. The files SHOULD land with the same UID and GID NUMBERS as on the old server. Only if you have gone through the steps to ensure that the account names and account and group numbers MATCH on the two servers will you get the results you expect by name.

Rsync with -a should NEVER modify the ownership from what it was on the source, but there are some complicating factors. It does NOT allow the receiving OS to just "guess" or be creative with the new values. If the rsync process lacks the permission to change ownership or permissions after the copy you CAN see some very odd results. Did you log the output and check for warnings and error messages?
 
Old 01-28-2011, 03:01 PM   #3
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
That's exactly what I would expect from the command I posted above. If I rsync the folders / files over to the new server, they should all have random UID's for the owner of the /home/ folders but that's not what I'm seeing. I show they all our owned by root:root on the target server but on the source server, the users home folders are all owned by their unique UID and have a permission mask of 700. Don't understand why this is happening.
 
Old 01-31-2011, 11:39 AM   #4
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 3,491

Rep: Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541
Rsync

I find that I can replicate the behavior, but not using that command-line.

If you do NOT specify to preserve ownership and permissions ( -p -g and -o , all among those implied by -a ) then it lands with the ownership and permissions set by the receiving user.

If the receiving end is run by root, then the files and folders belong to root.

The standard compile options on recent version specifically make ssh the default. I have not investigated the RHEL 5.5 version itself, but would be GREATLY surprised if the RH guys had neglected to make security the default!

1. Try leaving off that '-e ssh' option.

2. check that you have ONLY ONE rsync executable on each machine, so that only the recent version can be called. (I would not delete any unexpected additional instances of rsync, but you might compress any that you find for the duration of a test.) If you have and must preserve multiple versions, call the correct oe using a full path. Make sure that the correct rsync is the first one found in the path of the user on the remote end.

Please let me know what you find.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
rsync with permissions, but not as root nifflerX Linux - General 5 09-29-2011 12:14 AM
Rsync Permissions Problem digitalquill Linux - Security 9 01-19-2009 09:03 AM
rsync permissions issue zeeple Linux - Software 3 11-03-2008 09:13 PM
Copy files retaining ownership/permissions stefaandk Linux - Newbie 4 09-07-2006 09:25 PM
Windows Rsync Upload to Linux Rsync - permissions inspleak Linux - Software 0 10-12-2004 03:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:15 PM.

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