LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Rsync Directory Replication (https://www.linuxquestions.org/questions/linux-server-73/rsync-directory-replication-4175445073/)

doublez13 01-10-2013 09:53 PM

Rsync Directory Replication
 
I'm trying to synchronize two directories on two separate server and haven't found many good ways to do it. I've concluded that rsync and cron is the best way. I synchronize the shares and then use Samba as a way to access the shares from windows machines. My question is... if I syncronize the owner and group and permissions over, will anything go wrong. I've never understood how that works with UIDs and all

pan64 01-11-2013 12:49 AM

you would need to explain what is that anything which went wrong. We cannot fix anything. What did you make and what was the error message you got?

doublez13 01-11-2013 01:12 AM

I havent done anything yet. I'm asking if I do set this up, will I have troubles. I read that keeping the ownership and permissions on the files can mess things up if the UIDs don't match. Is this the case.

DaneM 01-11-2013 01:15 AM

I think the OP is asking of something is likely to go wrong. The answer is "yes."

You can find the UIDs of your users with the following command:
Code:

less /etc/passwd
Find the lines with your users at the beginning (the rest are system "users" that don't log in so much as own and manage stuff) and note the number after the second colon. Mine looks like this for my users:

Code:

root:x:0:0:root:/root:/bin/bash
dane:x:1000:1000:Dane Mutters,,,:/home/dane:/bin/bash

root should always be user "0", but other users will have different numbers, depending on what the system assigned to them. On some distros the first non-root user always gets UID 1000; others is 500; others are different, still. Even from one PC to the next (with same distro), it can differ somewhat.

The problem is making the UIDs from one PC match those on another so that you can access them from the other PC. Alternatively, you can use a chown or find/chown command to change the UID or user (that is, by name or by number) to one on the other system--either as part of the backup process or as part of accessing the data. I don't recommend using chmod, since this will basically defeat the purpose of keeping the user the same (by setting all the permissions to rwx or some such).

You should look into how rsync deals with user preservation--whether by name or UID. Also look into "--owner", "--group", "--super", "--fake-super", and any others you find in rsync.

Hope that helps.

--Dane


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