Securing a file as read only in Linux.

Scenario: if you want to make a file remain unchanged in Linux, even the root user should not perform any operation on that file. This requirement will be when you have any data in your pen drive or hard disk that should be unchanged.

Solution: To secure your file do the following command syntax

# chattr +i file

When you do this even the root user can’t delete or update the file.

To unlock this

#chattr –i file, only root can set the attributes and then it gain access.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: