• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

SMASHING LAB

GUIDES | LINUX | GEEKY STUFF

  • Nginx
  • Linux
  • Guide
  • Ubuntu
  • WordPress
  • Drones, My Hobby

How to Avoid Accidental File Deletion in Linux

By Imran Yousaf

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

1
sudo pacman -S python-pip

RedHat / OpenSUSE

1
2
3
sudo yum install epel-release
 
sudo yum install python-pip

Debian / Ubuntu / derivatives

1
sudo apt-get install python-pip

Installation of the rm-protection program:

1
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:
1
2
protect my_file.txt
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.

Some more articles you might also be interested in …

  • 19 Useful Features of the .htaccess File
  • How to Save the Output of the Command Terminal…
  • How to Convert JPG to PDF in Linux
  • Top 5 Linux Distributions for Programmers
  • How to Shutdown Linux System from a Terminal
  • 20 Awesome Nmap Command Examples for Linux
  • Crontab Examples: Running Cron Jobs in Linux
  • Simple, Reliable and Convenient Monitoring of Linux Servers
  • How To Dual Boot Linux/Ubuntu and Windows 10…
  • How to Install LAMP Stack (Linux, Apache, MySQL,…
Tweet
Pin
Share
0 Shares

Filed Under: Guide

Primary Sidebar

  • Twitter
  • Facebook
  • Google+

Recent Posts

  • How to install Nextcloud on CentOS 8
  • How to install Zabbix on openSUSE Leap 15.1
  • How to Easily Configure Your Domain’s Email Account with Gmail?
  • Tails 4.4 OS Released with Tor Browser 9.0.6
  • How to Convert JPG to PDF in Linux

Subscribe to our Newsletter

Useful articles, tips and videos about creating and promoting websites to your mail



* required field


  • Contact Us
  • Privacy Policy
  • About Us

Copyright © 2021. Smashing Lab