Although Gnu / Linux is a very safe operating system, the truth 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 as it prevents the accidental deletion 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 plugins, for this we open a terminal and write the following:
Arch Linux and derivatives
sudo pacman -S python-pip
RedHat / OpenSUSE
sudo yum install epel-release
sudo yum install python-pip
Debian / Ubuntu / derivatives
sudo apt-get install python-pip
Installation of the rm-protection program:
sudo pip install rm-protection
protect -R carpeta/
Once you press 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 that 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 may seem tedious, we can do something like encrypt the home folder and prevent our files from being accidentally deleted.
The system that rm-protection uses is simple and the program has a basic operation, something that we can check thanks to the program’s github repository, but it is fully functional since the question will make us determine what we are doing and what file we are deleting.