Stop letting your sticky bits vanish when you sync files
Permissions & Security (Chmod/Chown/ACLs/SELinux/AppArmor)
Stop letting your sticky bits vanish when you sync files
🧩 The Challenge
You know that feeling when you set up a shared directory with the sticky bit so users can only delete their own files, but then you run an rsync or cp and everything resets to basic permissions? I have spent way too much time cleaning up permission messes because I forgot the standard tools love to strip those bits.
💡 The Fix
Use the specific archive flags that preserve special modes like the sticky bit or setgid during your copies. It keeps the directory security sane without needing to manually run a bunch of chmod commands after the fact.
rsync -av --chmod=u+rwx,g+rws,o+t /source/ /destination/
⚙️ Why It Works
Adding that explicit chmod filter to the rsync command forces the preservation of special mode bits regardless of how the source filesystem is behaving. Most people forget the ‘s’ and ‘t’ flags, but they are the only things stopping your team from deleting each other’s work by accident.
🚀 Pro-Tip: Always test your sync with -n first, unless you like explaining to your boss why the entire dev team lost their shared scratch space.
Linux Tips & Tricks | © ngelinux.com | 11/27/2026
