How to protect files in Linux

In a computer equipment it is possible to accumulate a Lots of information which can be like a true tower of Babel and as a consequence, the saturation of the system can become important. But much more important are some of our data, which can be really fundamental for our day to day and losing it or having someone access it would not be a dish of good taste at all.

Computer security is essential

Computer security is essential

For these cases we have the chattr command, which will allow us to protect the files that matter most to us.

The chattr command is typically used to modify the attributes of the ext2 and ext3 filesystems. You could say that this command is analogous to the chmod command, but with different syntax and options. If used properly, we can make it difficult for an intruder who has gained sufficient privileges on our system to interact with our files.

The command is very easy to use, and with it we can change the properties of our files or folders in a simple way. For example, if we want that a file cannot be deleted, nor renamed, that symbolic links cannot be pointed out, nor can data be written to the file, we will use the following syntax:

# chattr + i filename or path

To work with folders it is identical, the only difference is that if we want to change attributes in the files on a recurring basis (the files that the folder contains) we will use the –r attribute.

# chattr -r + i folder name or path

But we have many more options available, which we can know as always in the manual: man chatter


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.