Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What's the command under Linux to mark a file as "locked"/to prevent any changes from being made to it?

I'm not talking about chmod. There's a property that can be set (the name escapes me at the moment) which prevents even processes running as root from changing a file. What is this called and how do I set it?

I have forgotten what this is called and without remembering the name the search function on the site and on Google is failing me.

share|improve this question
I think looking at all those ponies yesterday rotten my brain. Maybe it's just because it's Friday... I know it's a stupid question but I just can't for the life of me remember what this thing is called right now! – Josh Apr 2 '10 at 21:30
Are you searching for chattr? Sometimes, memory fails ;) – sntg Apr 2 '10 at 21:33
Yes I was. Specifically the "immutable bit". If I had remembered "immutable" then a google search would have answered my question in 0.01 seconds! – Josh Apr 2 '10 at 21:44
up vote 8 down vote accepted
chattr +i <filename>
share|improve this answer
Perfect -- that's it. Thanks! Isn't there a name for "+i" for my future reference? – Josh Apr 2 '10 at 21:36
immutable (this intentionally left blank) – deleted Apr 2 '10 at 21:39
YES -- That's the word that was escaping me. Thanks guys! – Josh Apr 2 '10 at 21:43

I think you are looking for chattr ?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.