Pages

Tuesday, August 26, 2008

Making files undeletable, updatable only and unbackupable

Attributes on a file can help you control what people can do with different files you can make files
1: Undeletable (Even by root)
2: Updatable only (Even by root)
3: Unbackupable :) (Even by root)

1: to make a file undeletable type
chattr +i filename
even if root trys to delete the file they will not be allowed to, To make the file deletable again you will need to type
chattr -i filename

2: to make a file updateable only, which means that you will be able to append content to the file but you will not be allowed to delete it or remove content from it
type

chattr +a filename

3: to prevent a file from being backed up by admins using the dump command

type

chattr +d filename
to list the set attributes of a file type
lsattr filename

1 comment:

Yong Huang said...

It would be nice to allow in-place update, not append. For example, database software needs to change some data in the middle of a datafile. We should allow that, and we should not delete the datafile, which is the type of accident we IT professionals have all heard of or even got involved in. As far as I know, no modern file system supports the undeletable but updatable (not just appendable) files.