5 ‘chattr’ Commands to Make Important Files IMMUTABLE (Unchangeable) in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Narad Shrestha

He has over 10 years of rich IT experience which includes various Linux Distros, FOSS and Networking. Narad always believes sharing IT knowledge with others and adopts new technology with ease.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

8 Responses

  1. ganesh says:

    Can anyone please explain me about -e options in chattr.
    I am seeing like this
    ——————–e– for the file.

    • Shashank says:

      It indicates that the file is using extents for mapping the blocks on disk. Extents is file system dependent. You’re most likely using ext4. It may not be removed using chattr. To know more about extent, see the wikipedia page for extent(filesystem)

  2. Noob says:

    I love Tecmint. Always great information. Thanks guys.

  3. Naagabaabu says:

    Thanks for you information on chattr command. There is one small modification in 4th point. You need to change the placements of the command..

    chattr +a filename and example to add data

    chattr -a filename and example to add data

  4. Nishant says:

    Thank you for pointing this out. I needed chattr -ai to fix a directory that was mute. Appreciate it.

  5. Kyle H says:

    If you chattr +i /etc/shadow, users can’t change their passwords either.

  6. Vinodh says:

    Thanks for the posting Narad :)

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 177,942
  2. 8,310
  3. 37,548

Are you subscribed?