How to Protect the accidental deletion of diles in Linux – rm protection

Although Gnu/Linux is a very safe operating system, the fact is that sometimes it happens that we delete files by mistake and then it is difficult to recover.

This can happen and more if our computer is shared. Here we tell you how to avoid this thanks to a program called rm-protection, a python program that will help us avoid these problems and avoid problems with external recovery programs.

The operation of rm-protection is very simple because it prevents the deletion by mistake of any file in Gnu/Linux. First we have to install the RM-Protection program and in some cases we have to install special python add-ons, for this we open a terminal and write the following:

Arch Linux

sudo pacman -S python-pip


sudo yum install epel-release
sudo yum install python-pip


sudo apt-get install python-pip

Installation of the rm-protection program:

sudo pip install rm-protection

Once the program is installed, we have to select the files or directories that we want to encrypt, for this we only have to write the following

protect file.txt
protect -R folder/

Once hit enter, the program will ask us for a security question and an answer.

After establishing this, every time we try to delete a protected file, the operating system will ask us the question we have marked before and we must also enter the answer that we have entered before, as we wrote it, otherwise it will give an error and we will not be able to delete the archive.

And although it seems tedious, we can do something like encrypt the home folder and make our files are not accidentally deleted.

The system that uses rm-protection is simple and the program has a basic operation, something that we can check thanks to the github repository of the program, but it is fully functional because the question will make us determine what we are doing and in what file we are deleting.

Leave a Comment

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

Scroll to Top