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 archivoMost useful options
+iImmutable: nobody can modify or delete-iRemoves immutability+aOnly allows appendingCopy-ready examples
$ touch importante.txt && sudo chattr +i importante.txt && lsattr importante.txtMake a file immutableYou 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.
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