Home > Bash Tip & Tricks > How to make a file unchangeable or unalterable (only for ext2/ext3 file systems)

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

December 25th, 2008 Leave a comment Go to comments

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

  1. No comments yet.
  1. No trackbacks yet.
*

Statistical data collected by Statpress SEOlution (blogcraft).