Backup & Recovery (Rsync/Tar/Dd)
Stop letting rsync mangle your file permissions on the way out
🧩 The Challenge
You finally moved your data to a new box, but suddenly your web server is throwing 403 errors because every file is now owned by your local user. I’ve wasted entire afternoons fixing bad permissions because I forgot the default behavior of rsync when moving between remote systems.
💡 The Fix
Use the archive flag in combination with the specific ownership flags to force rsync to keep the original UID and GID mapping regardless of who runs the command. You really need to run this as root for it to actually take effect on the destination.
rsync -av --numeric-ids --super source/ destination/
⚙️ Why It Works
Passing the numeric-ids flag stops rsync from trying to map user names from the source box to the destination box, which is almost always where things go sideways. The super flag then tells rsync to try and preserve those original permissions even if you’re executing the sync as a regular user who might not have traditional root privileges on the remote end.
🚀 Pro-Tip: Always do a dry run with -n first so you don’t overwrite your production configs by mistake.
Linux Tips & Tricks | © ngelinux.com | 9/11/2026
