I'm periodically backing up my Mac user-folder to a remote machine by running rsync with a cron job on my machine. I'm thinking that anything useful will be in the user-folder and I can always reinstall the missing software with homebrew, so no use backing up anything else.
My backup command looks something like this:
rsync -av --delete /Users/oxprox_1/ -e "$SSH_OPTS" remote_machine:/backups/oxprox_1/
Now I recently had to replace my hard drive and do a clean install of a new OS. It was the first time I had to rsync my whole user-folder back. During the OS install I changed my username so the user folder on my machine is now named differently and I guess this UID number is also different even if the name had been the same (or is it?). If I remember correctly, I ran something like this on my machine to pull my files back:
sudo rsync -av remote_machine:/backups/oxprox_1/ -e "$SSH_OPTS" /Users/oxprox_2/
I think I used
sudo because it wouldn't modify files without it. If I remember correctly I had some issues with the permissions of my files and I managed to figure it out somehow, maybe by manually changing all the permissions, but I have been having some weird problems and issues after that.
Now I'm planning to do a new clean install and pull my old backups again, as I have not been updating the files on the remote machine after the hard drive change. So how should I do this to get the permissions correctly when returning files on my clean install, even though the username is different? I guess it should transfer all the permissions to the new user on the destination side. I want to transfer all the preferences and setting for the applications and not just my documents etc.
I have been reading about the rsync archieve option and I think maybe it could work if I just use
-rlptDv instead and omit the
-o option, but I'm not sure. Also what about the group permissions, I'm the only user on my computer.
Could you help me to understand how to do this properly? I have been reading answers here but I still don't understand this fully. I'm also open to suggestions if there are some better options to do the backups. I would still rather use rsync than Time Machine because it's so neat and easy to automate. Thanks!