Tuesday, April 01, 2008

Make a file "immutable"

This concept came up in response to my query in ForesightLinux forums about DNS servers. Hadn't come across it before but could well be useful at times. See this wiki page.

Edit (21-06-08):
I find myself using this post a lot but I haven't actually detailed HOW to make a file immutable and the wiki is a little confusing.
So, to put this right, I'm going to show here how to make (and unmake) the /etc/resolv.conf file immutable:

To make the file immutable:

Code:
chattr +i /etc/resolv.conf

You can check with:

Code:
lsattr /etc/resolv.conf

It will give you
----i------------- /etc/resolv.conf

To get rid of the immutable flag just do

Code:
chattr -i /etc/resolv.conf

No comments:

Post a Comment