moving files and directories between two machine, via a third, preserving permissions and usernames
- by Jarmund
The situation is as follows:
Machine A has a file repository accessible via rsync
Machine B needs
the above mentioned files with all permissions and ownerships intact
(including groups etc)
Machine C has access to both A and B, but has a completely different set of users.
Normally, i would just rsync everything over, directly between A and B, but due to severely limited bandwidth at the moment, i need something different, as rsync times out after building the list of the 430 files (49Mb uncompressed... can be compressed down to ~7Mb).
What i've tried so far:
rsync everything over from A to C, tar it, copy the tarball over, and then untar it, however, this messes up the ownership and/or the permissions.
To rsync it from A to C, i run this command:
rsync --numeric-ids --password-file=/root/rsync_pwd_file -oaPvu rsync://[email protected]/portal_2/ ./portal_2/
...and from the looks of things, they do end up on C with the correct ownerships/permissions/flags/everything (not 100% sure, though.. are there any more switches i can throw in there? did i miss something?)
copying the tarball over is simple enough (slow as a one-legged turtle due to the bandwidth, but it checksums out alright)
What i'm unsure of is the flags and switches for creating and extracting the tarball, so could someone please provide the full commands for creating a tarball from /root/portal_2 on machine C (with everything intact) and extracting the tarball into /var/ex/portal_2 on machine B? ?
Also, are there any other approaches worth mentioning that could allow me to perform this? I have root access to A and C, whereas i only have rsync access to B.
PS: I'm running rsync v2.6.9 on machine B, and unfortunately i do not have the oportunity to upgrade to v3