rm-protection: A safe alternative when deleting files

Many people have had trouble using the famous but dangerous rm commandEven days ago it was known GitLab data loss when by mistake your sysadmin deleted the wrong database. For this last reason and some others, the idea of create a tool that allows verifying that when deleting files the user is sure of the procedure he is performing and the result of that idea is rm protection.

Although there are already other tools that allow us to delete files safely, rm protection it has characteristics that probably make it much more flexible and interesting.

What is rm-protection?

It is an open source tool, developed in Python, as a safe alternative for file deletion. His behavior is the same as the famous rm command (including its arguments and manner of use). The only difference is that this command does not delete those files where there is a .*.rm-protection and no answer was given to the verification question.

¿What is the safest way to check that when deleting files we are not ca $% / & ...? Well, for the creators of rm-protection, the answer is that the user himself confirms that he wants to delete the file in question. Also, it gives users the opportunity to put marks on those files that are really important, saving most users a lot of headaches.

rm protection aims to provide maximum protection and flexibility, as well as having the least possible impact on daily operation. rm command

How to use rm-protection?

The use of rm protection it is quite simple, it is composed of two functionalities: rm-p y protect. Being protect the person in charge of protecting the files that we want not to be eliminated (or that can be eliminated as long as it is the real desire of the user).

This can best be seen in the following case study:

We want the file named no_me_elimines.txt cannot be eliminated, or failing that it can only be eliminated if a security question is answered, in that case it is enough for us to execute protec no_me_elimines.txt  and indicate the security question and answer. In case we really want to delete the file we just have to execute rm-p no_me_elimines.txt and answer the security question.

We can see rm protection in action, in the following gif:

delete files

How to install rm-protection?

The installation and configuration of rm-protection is quite simple, we must have python pip installed, then we open a terminal and execute the following command:

pip install rm-protection It is also convenient to create an alias of rm-p, to be used as rm, so it will be more efficient when using alias rm="rm-p"

Then start protecting your files using protect.

This is undoubtedly an interesting way to safely delete files, since we can better protect our most important files. Also, if we play around with the commands we could even protect files or directories that meet certain characteristics.


Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  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.

  1.   cristian said

    Very useful Thank you very much

  2.   carlitux said

    Super useful! And my own experience tells me that I should install it as soon as possible because it is already reminding me of episodes that I wish to have well forgotten. The rm command is useful but can cause major catastrophes.
    Thank you very much.
    Regards!

  3.   Anonymous said

    Thank you very much!

  4.   Sebas said

    Something tells me that it will not work, in the same way that the current command causes the problems: because the lapse ends after you smear it.
    And I think that nobody is going to protect each file / folder, which should and could already be protected by a permission.