8 chattr Commands to Make Files Immutable and Prevent Changes in Linux

Written By
T
TecMint
Sep 22, 2026

Most sysadmins reach for chmod when they want to lock down a file. The problem is that chmod 000 only changes the file’s permission bits; root can still override them. That’s where chattr comes in.

The chattr command lets you set and unset filesystem-level attributes on files and directories. These attributes are enforced at a lower level than traditional Unix permissions, giving you an additional layer of protection.

For example, chattr +i makes a file immutable: it cannot be modified, renamed, deleted, or replaced through normal filesystem operations, even by root. The attribute must be explicitly cleared with chattr -i before the file can be changed.

T

TecMint

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.