Permissions and owners

The chattr command

Changes special file attributes, such as making it immutable so not even root can delete it.

Syntax

chattr +i archivo

Most useful options

+iImmutable: nobody can modify or delete
-iRemoves immutability
+aOnly allows appending

Copy-ready examples

$ touch importante.txt && sudo chattr +i importante.txt && lsattr importante.txtMake a file immutable

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • To modify an immutable file you must first remove the attribute with chattr -i.

Related commands

FAQ

What is +i for?

To protect critical files from accidental changes or deletion, even by root.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course