Stopping God (Root) from Deleting File


You can make a File “immutable” or “unalterable” that it cannot be changed or deleted even by root. Note that this works on (ext2/ext3) filesystems AFAIK.

You can accomplish this by making a file “immutable” by using chattr +i filename command
From the man page:

A file with the ‘i’ attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

Ok maybe this is not Rocket Science for most readers reading this, but I think it’s worth a mention. You can undu this by using chattr -i filename:

2007-12-20-121357_1280x800_scrot

You can read more about changing file attribution (chattr), over here:
http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=chattr



Subscribe without commenting


Leave a Reply

Note: Any comments are permitted only because the site owner is letting you post, and any comments will be removed for any reason at the absolute discretion of the site owner.