---

How to make a file immutable on Linux

chattr is a Linux command which allows one to set or unset attributes on a file, which are separate from the standard (read, write, execute) file permission.

A related command is lsattr which shows which attributes are set on a file. While file attributes managed by ‘chattr’ and ‘lsattr’ are originally supported by EXT file systems (EXT2/3/4) only, this feature is now available on many other native??Linux??file systems such as XFS, Btrfs, ReiserFS, etc.