I'm using the method described here to copy a directory from one Unix server to another (both Ubuntu 14.04):
rsync -aruv localfolder/ user@server:destination/
I need to keep the same owners and permissions, but the IDs of the users on the new machine may be different. I think that's why the method described doesn't work properly for me: all the files get owner
my-user:my-user (supposed I'm using
my-user@server) to copy the files to the server.
So, basically, what I need to do is copy the folder (did that), and then, for every file, check what is the ID of the user with the same name on the new machine, and update the owner on the new machine with the new ID.
Is this possible? Or is there a simpler way to do this?