Protecting files from unwanted deletion is very important security on the tasklist of Unix Administrators. On Linux boxes you can use the chattr command.

Let’s give you some examples how chattr work under Linux -

To make a folder undeletable, run -

sudo chattr +i -R foldername

After that, you can’t delete, rename or do anything with this folder. But if you don’t need this folder anymore or you’ve got to apply some changes to it run -

sudo chattr -i -R foldername

To make a file undeletable, run -

sudo chattr +i filename

To be able to change or delete the file, run -

sudo chattr -i filename


comments powered by Disqus