Keeping file permissions sane during rsync restores
Backup & Recovery (Rsync/Tar/Dd)
Keeping file permissions sane during rsync restores
🧩 The Challenge
Backing up your system files is only half the battle, because you’ve definitely had that moment where you restore a directory only to find that every file is suddenly owned by root. It’s a total headache when the app permissions get mangled and the whole service refuses to start.
💡 The Fix
Throw the right flags to tell rsync to keep its hands off the metadata and preserve the original ownership and mode bits exactly as they were. You’ll save yourself hours of chasing down “permission denied” errors later.
rsync -aHAXv --numeric-ids /source/ /destination/
⚙️ Why It Works
Passing –numeric-ids is the secret sauce here because it stops rsync from trying to map UIDs and GIDs to your local system’s user database, which usually causes a disaster when moving backups across different servers. The -aHAX flags bundle up your recursive copy, hard links, and extended attributes so the filesystem state is actually cloned rather than just copied.
🚀 Pro-Tip: Always dry-run with -n first so you can see if you’re about to overwrite something important before the damage is done.
Linux Tips & Tricks | © ngelinux.com | 9/16/2026
