Four Secure File Deletion tools in Linux

Source: Internet
Author: User

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:

  • Srm
  • Smem
  • Sfill
  • Sswap

Run the following command on the Ubuntu terminal to install the tool:

  1. sudo apt-get install secure-delete

Run the following command in RHEL, Fedora, or CentOS to install the tool:

  1. 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.

  1. 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.

  1. 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.

  1. cat /proc/swaps

The following is an example of the output of the preceding command:

  1. aun@eagle:~$ cat /proc/swaps
  2. FilenameTypeSizeUsedPriority
  3. /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.

  1. 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.

  1. 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:

  1. aun@eagle:~$ whereis shred
  2. shred:/usr/bin/shred /usr/share/man/man1/shred.1.gz

Use the shred tool to run the following command to delete an object:

  1. 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.

  1. 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.

  1. shred -n 100 filename

If you want to truncate or delete an object after rewriting, use the "shred-u" option:

  1. 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.

  1. 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 ".

  1. 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.

  1. sudo aptitude install wipe

Run the following command to install Wipe in RedHat Linux, Centos, or Fedora:

  1. sudo yum install wipe

Once the installation is complete, run the following command on the terminal to obtain the complete list of available options:

  1. man wipe

Delete any file or directory:

  1. wipe filename

Run the following command to safely remove the tmp partition:

  1. wipe -r /tmp

Use the following command to delete the content of the complete partition (replace the partition name with your expected partition ).

  1. 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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.