Andrew Mercer
on this page

Extended attributes on ext4/XFS/btrfs files. Reference: chattr (Wikipedia).

lsattr file                            # show attributes
sudo chattr +i file                    # immutable: cannot be modified, deleted, renamed, or linked, even by root
sudo chattr -i file                    # clear it
sudo chattr +a logfile                 # append-only: can be added to but not overwritten or deleted
sudo chattr -R +i /path/to/dir         # recursive

Prevent a directory (and its contents) from being deleted

sudo chattr +i /srv/important
sudo rm -rf /srv/important             # fails: Operation not permitted
sudo chattr -i /srv/important

The immutable bit stops everyone, including root, until it is removed. It is a useful last line of defence against accidents and simple malware, and a common reason a "root cannot delete this file" question appears. Check lsattr when a permissions-looking failure has clean permissions.