How to make a file unchangeable or unalterable (only for ext2/ext3 file systems)

If you have a file that you want nobody can change it, you shall type the following command into a shell

# sudo chattr +i filename

You can check the attributes using the following command:

# lsattr

----i------------- ./gg1.txt
 

Now also the root user cannot delete the file, if the root user want to change/delete this file he shall reset the file attributes as follows:

# sudo chattr -i filename

You can check the attributes using the following command:

# lsattr

------------------ ./gg1.txt

 

Merry xmas

Posted by at December 25, 2008
Filed in category: Bash Tip & Tricks, and tagged with: , , , ,

Leave a Reply

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

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <font color="" face="" size=""> <span style="">

Statistical data collected by Statpress SEOlution (blogcraft).