Login Register

How to Delete Your Data Securely on Linux

By J.Austine
How to Delete Your Data Securely on Linux

On Linux, files can get erased and still get recovered. There are many software that can recover deleted data from a hard drive. The software may be paid or free. However, you may want to delete your data securely and not want it to be recovered. The reason being, someone might recover the data and misuse it.

So, it is crucial that you delete your data securely before selling your hard drive.
Every time you delete a file from your Linux system using the rm command, it is not erased completely. In fact, the file system just frees up the appropriate inode. Yet, the contents of the old file are still in that space until it is overwritten. This paves the way to recover the files.
The space that you created is now free to be used by other new files. Until the space is overwritten, there is a good chance that the deleted file can be recovered.

Let us learn how to delete data in Linux.

"Secure-delete" is one of the many tools to delete important files or folders in Unix-like operating systems. The tool provides four useful utilities. So then, the utilities erase data from your system. The erased data is very hard to recover using any data recovery software. The utilities are as follows:
srm: This is a secure rm used to erase files by overwriting their hard disk space and deleting them. The larger the file, the longer it will take to wipe and rewrite it.

srm starts processing the directories and files.
How to Delete Your Data Securely on Linux
And finally, all of the files and subdirectories were removed as expected.
How to Delete Your Data Securely on Linux
sfill: It overwrites free space on the hard disk
How to Delete Your Data Securely on Linux
How to Delete Your Data Securely on Linux
sswap: It overwrites swap space.

So the first thing is to identify your sswap partition

How to Delete Your Data Securely on Linux
Simply locate the word swap and make a note of the lock device it's attached to
How to Delete Your Data Securely on Linux
Sdmem: it wipes the RAM once secure-delete gets installed.
The terminal window will fill up with asterisks as an indication that sdmem is working its way through your RAM.
How to Delete Your Data Securely on Linux
Following that, always double-check before using secure-data utilities. In addition, all these are dangerous on SSD drives or any other flash-based media. SSDs store information differently from hard disk drives. We advise you to use the manufacturer's utilities to erase SSDs. As for HDDs, the method will work just fine.

Other Tools You Can Use to Delete Your Data Securely

Using Shred
Shred works by overwriting a deleted file that, in turn, becomes hard to recover. It is like tearing a paper into a lot of pieces; hence it is impossible to recover the original data. The meaning of letters in an output is:
-u: deallocates and removes file after being overwritten
-v: turns on the display of operation progress
-z: to hide shredding, it adds a final overwrite with zeros
-n: the total number of times the file content will be overwritten
In all Linux distributions, shred is installed by default. If you want, you can find its installation path by running the following command:
To remove files using the shred utility, run the following command on the first three phases. Then remove the -u flag from the previous command
How to Delete Your Data Securely on Linux
After that, replace the partition name with your desired division. Use the default overwrites file with random contents to shred 25 times. You can specify the number of overwrites with the "shred-n" option.
How to Delete Your Data Securely on Linux
Use the "shred-u" option to truncate and remove the file after overwriting.
How to Delete Your Data Securely on Linux
Using dd Command:
The dd command primarily converts or copies files. The command can completely overwrite your hard drive with zeros. Yet, DD does not zero a drive that is currently in use.
Look at this
How to Delete Your Data Securely on Linux
At first, the command got used for Disk Cloning. It copies the contents of one partition or disk to another. Furthermore, it gets used to wipe out the contents of a hard disk or partitions securely. To overwrite current data with random data, run the following command.

All Linux distributions have the dd command.

When Not to Use Shred
Note that shred does not work well in all situations. The utility does not work well when used on specific file systems. These are:
Compressed file systems
RAID-based file systems
File systems that store cache
File systems that store snapshots
Journaled or Log-structured file systems (ext3, XFS, and JFS)
Also, the shred man page indicates that the command doesn't work with ext3 only if it's in journal mode. You should not use the shred utility on SSDs. The reason being, the additional erase and write process can damage your storage.

The Trouble of Deleting Your Data Securely

As good as shred is, it has an issue. Modern journaling file systems go to tremendous efforts to ensure they don't break or lose data. With journaling filesystems, there is no guarantee that the overwriting is actually taking place. Usually, over the hard drive space is occupied by the deleted file.
Shred deletes data more thoroughly than rm would have. But, do not think that the data is gone and not recoverable. That might not be the case.
Using Wipe
The Linux wipe command allows users to delete data from hard disks permanently. The command erases files from magnetic history. After that, it rewrites the space repeatedly and wipes away the caches. The command uses the Gutmann algorithm or repeated writes. This makes the erased data almost impossible to recover.
You can erase content from a single file, folder, or entire hard disk with this command. However, formatting the whole disk will take a good amount of time. The installation and use of the wipe utility are pretty straightforward.

What Happens When Cybercriminals Recover Deleted Data?

Files containing personal information and financial reports are not safe if judt deleted. For instance, cybercriminals can retrieve the data and use it for malicious intent. For example, the data can be sold on the dark web. The darknet has a black market for contraband like stolen data and child pornography.
Cybercriminals and other dark web users access the platform via an anonymizing browser called Tor. Alongside a VPN, Tor makes the tracking of dark web users difficult. Also, cryptocurrency gets used in a transaction for anonymity.
Thus, you need to take further steps to ensure your deleted data is irretrievable. Otherwise, it might end up on the darknet.
Instead of securely deleting files, you can secure your hard drive using encryption. With that, no one can access anything, whether deleted or not. Moreover, you do not always have to remember to erase sensitive files. Your files already have protection.
Many Linux distributions ask whether you want to use encryption to install time. Saying "yes" will save you a lot in the future.

Do you find this content interesting?
This is just a MIRROR ! Find us via our Main TOR domain
And Let us know by leaving a comment and a rating.

Also, don't forget to follow our Official Telegram Channel to stay informed and safe by ReadingĀ  NOIRdotNEWS