donderdag, december 22, 2005

Making files immutable on Linux !

Here’s a pretty cool and quick Linux tip. There may come a time when you have some files on your Linux box which you would like not to be able to delete for whatever reason, even by the root user. If so, open a shell window, log in as root and type chattr +i file where file is the name of the file you’d like to make immutable (read: undeletable). If you ever want to reverse this, just follow the same process but replace +i to -i. Please note this only works if you’re using the Ext2 or Ext3 filesystems.