Backup & Recovery (Rsync/Tar/Dd)
Stop tar from dying when it hits a permission denied error
đź§© The Challenge
Trying to pull a quick backup of a directory structure that includes some root-owned logs or system files usually ends with tar throwing a fit and exiting early. I’ve wasted hours debugging failed archives only to find out it bailed because it couldn’t read one single file in a sub-directory I didn’t even care about.
đź’ˇ The Fix
Add the ignore-failed-read flag to your command so tar finishes the job even when it runs into files it doesn’t have permission to touch. It keeps the process running and ensures you get 99 percent of the data instead of zero.
tar --ignore-failed-read -cvzf backup.tar.gz /path/to/directory
⚙️ Why It Works
By default, tar treats a single missing file as a fatal error and halts the entire operation immediately. Forcing this flag tells the utility to just print a warning to stderr and keep on trucking through the rest of the file list.
🚀 Pro-Tip: Use the –warning=no-file-ignored flag if you are tired of the terminal being spammed with messages for every file it couldn’t open.
Linux Tips & Tricks | © ngelinux.com | 7/22/2026
