Four Secure File Deletion tools in Linux
Any normal-level computer user knows that any data deleted from the computer system can be recovered later through some efforts. This is a good solution when you accidentally delete important data. However, in most cases, you do not want your private data to be easily restored. Whenever we delete any file, the operating system only deletes the index of specific data. This means that the data is still stored in a disk. This method is not safe, any smart computer hacker can use a variety of good data recovery tools to restore your deleted data. Linux users use the "rm" command we all know to delete data from their operating systems, but the "rm" command also deletes files as mentioned above. Data deleted from this command can also be restored using a special file restoration tool.
Let's take a look at how to safely and completely delete files or folders from your Linux system. The tools mentioned below can completely delete data, so it is difficult for those recovery tools to find traces of real data and restore it.
Secure-Delete
Secure-Delete is a collection of tools generated for Linux operating systems. They provide advanced technical support for permanently deleting files. Once Secure-Delete is installed on various Linux systems, the following four commands are provided:
Run the following command on the Ubuntu terminal to install the tool:
sudo apt-get install secure-delete
Run the following command in RHEL, Fedora, or CentOS to install the tool:
sudo yum install secure-delete
The "srm" command works in a similar way as the "rm" command, but it does not just delete files. It first uses some random data to overwrite the files several times and then permanently delete the files. The syntax of this command is quite simple. It only specifies the file or directory to be deleted, and then it will be responsible for this task.
sudo srm /home/aun/Documents/xueo/1.png
"Sfill" detects that the specified partition or directory is marked as idle or available space, and then uses its own algorithm to fill it with random data. Therefore, it ensures that no files or folders can be recovered in this partition.
sudo sfill /home
The "sswap" command is used to safely clear your swap partitions. Swap partitions are used to store the data of running programs. First, run the following command to find your swap partition.
cat /proc/swaps
The following is an example of the output of the preceding command:
aun@eagle:~$ cat /proc/swaps
FilenameTypeSizeUsedPriority
/dev/sda5 partition 208486071216-1
From now on, you can see the partition where your swap partition is set, and then use the following command to safely clear it. Replace "/dev/sda5" with your swap partition name.
sudo sswap /dev/sda5
"Smem" is used to clean up content in the memory. Although the content in random access memory (RAM) is cleared when the system is restarted or shut down, some data remains in the memory. This command provides safe memory cleanup and simply runs the smem command on the terminal.
smem
Shred
The "shred" command destroys the content of a file or folder in an unrecoverable manner. It uses a randomly generated data mode to continuously overwrite files, making it difficult to recover arbitrary destroyed data, even when hackers or thieves use high-level data recovery tools or devices. Shred is installed in all Linux distributions by default. If you want to, run the following command to find its installation directory:
aun@eagle:~$ whereis shred
shred:/usr/bin/shred /usr/share/man/man1/shred.1.gz
Use the shred tool to run the following command to delete an object:
shred /home/aun/Documents/xueo/1.png
Run the following command using shred to delete any partition and replace the partition name with the Expected One.
shred /dev/sda5
By default, Shred uses random content to overwrite data 25 times. If you want to overwrite the file more times, you can use the "shred-n" option to specify the expected number of times.
shred -n 100 filename
If you want to truncate or delete an object after rewriting, use the "shred-u" option:
shred -u filename
Dd
This command was initially used for disk cloning. It is used to copy a partition or disk to another partition or disk. However, it can also be used to safely clear the hard disk or partition content. Run the following command to overwrite your current data with random data. You do not need to install the dd command. All Linux distributions already contain this command.
sudo dd if=/dev/random of=/dev/sda
You can also overwrite the content in the disk or partition by simply replacing all with "zero ".
sudo dd if=/dev/zero of=/dev/sda
Wipe
Wipe was initially developed to safely erase files from magnetic media. This command line tool uses a special mode to repeatedly write files. It uses the fsync () call and/or O_SYNC bits to forcibly access the disk, and uses the Gutmann algorithm to repeatedly write data. You can use this command to delete a single file, folder, or the content of the entire disk. However, it takes a lot of time to use the wipe command to delete the entire disk. In addition, it is quite easy to install and use this tool.
Run the following command on the ubuntu terminal to install wipe.
sudo aptitude install wipe
Run the following command to install Wipe in RedHat Linux, Centos, or Fedora:
sudo yum install wipe
Once the installation is complete, run the following command on the terminal to obtain the complete list of available options:
man wipe
Delete any file or directory:
wipe filename
Run the following command to safely remove the tmp partition:
wipe -r /tmp
Use the following command to delete the content of the complete partition (replace the partition name with your expected partition ).
wipe /dev/sda1
Summary
We hope this article will be helpful to you. Your Data Privacy is decisive, installing these secure deletion tools in your system is very important to you, so you can delete your private data without worrying about their easy recovery. All the tools mentioned above are quite lightweight. They only require the lowest system resources to run and will not affect your system performance in any case. Enjoy the convenience they bring!
Via: http://linoxide.com/security/delete-files-permanatly-linux/
Author: Aun Raza Translator: dbarobin Proofreader: wxy
This article was originally translated by LCTT and launched with the Linux honor in China
This article permanently updates the link address: