Rsync Permissions Not Retained

Carlosinfl

Loves the juice
Joined
Sep 25, 2002
Messages
6,633
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?
 
Are you running rsync on the newer server as root?

Do the users and groups exist on the new server?
 
Are you running rsync on the newer server as root?

Do the users and groups exist on the new server?

When I issue the command (from the old server), I am prompted to enter the root password for the destination server (new server) so it's logging in as root on the target.

The users do not exist on the new server (target) but that shouldn't matter because it should simply copy the UID:GID from the old server and that's how it would show since it can't match anything in the new /etc/passwd file.

I don't get why this isn't copying file permissions when I use the -a switch.
 
When I issue the command (from the old server), I am prompted to enter the root password for the destination server (new server) so it's logging in as root on the target.

I believe rsync needs to run as root on both ends in order to preserve permissions, group and owner information of files.

The users do not exist on the new server (target) but that shouldn't matter because it should simply copy the UID:GID from the old server and that's how it would show since it can't match anything in the new /etc/passwd file.

I don't get why this isn't copying file permissions when I use the -a switch.

Yeah, thats what the rsync manual page seems to indicate. You might specify --numeric-ids just to be safe.
 
Back
Top