LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Using rsync to mirror source w/ existing permissions but target has different users? (https://www.linuxquestions.org/questions/linux-general-1/using-rsync-to-mirror-source-w-existing-permissions-but-target-has-different-users-4175735983/)

That Random Guy 04-13-2024 01:28 PM

Using rsync to mirror source w/ existing permissions but target has different users?
 
Basically, I'm trying to understand if it makes sense at all to use rsync between two hosts on a network that are both running their own tftp and nfs servers. Ideally, I'd be able to just mirror the contents of the existing nfs export directories on the source to the target, spin up the nfs server on the target, and all would work as it is currently working on the source. Same for tftp.

We can ignore any pre-existing network clients and their configuration for this... I'm more curious about the feasible implementation of this from the server perspective and having this just work as expected. I can always update the configs on the clients when needed but this migration of sorts has me kind of confused. We can also ignore any transport issues. These hosts can talk to each other fine.

The intent is not to have some kind of redundant HA sort of deployment but rather to move the data that is currently being served or present on the source host to the target and then decommission the source host once the services are running as expected. The services being nfs and tftp.

I did a little bit of reading and after inspecting the current hosts, I think I see a problem where using rsync would not help me do what I am thinking.

Right away, I notice that while both hosts have a dedicated tftp user that is used for the tftp daemon, they do not share the same UID on their respective system. This is also observed on the files/folders being served via tftp on the source.

Additionally, there are certain users who own certain files/folders under the nfs exports that do not already exist on the target host.

My current understanding is that while rsync can retain permissions from the source when mirroring to the target, unless the same users exist on the target, this will not work.

Has anyone had something like this come up before? or maybe someone can clarify?

P.S. - both hosts are running Ubuntu 20.04

wpeckham 04-13-2024 06:17 PM

rsync will clone the user NUMBER and group NUMBER on the files and folders. The user NAMES are linked to those number in /etc/passwd. IF you are using traditional services you would have to keep the passwd files in sync and keep the numbers the same between the two hosts. That can be tricky and a lot of piddling work and I do not recommend it.

If you use more modern services you can define VIRTUAL users and keep THOSE the same on both hosts, and then it all LOOKS right from a client machine.

Might be easier to just clone image the original host a few times (as backups and restore source), and restore ONE of those elsewhere to make your new target. IF you rsync between them after that everything should look right until one changes.

--------
OR: you could just copy the suff all into place (using rsync makes sense) then correct the ownerships on the target. IF it is just one time that may be faster and easier.


All times are GMT -5. The time now is 02:42 PM.