How to Securely Delete files Easily in Ubuntu Linux?

Just because we delete a file from our computer doesn’t really mean that it’s “gone”. Because the OS just removes the file from its index (if you’re not much of a tech-geek then think of it as a list where the OS keep a basic info about the files such as their location, size etc) rather than deleting the data on the individual sectors where the actual data of the file is located.

So by using an advanced scanning utility someone with a decent understanding could easily recover your sensitive data with ease these days. And also, even if you format your HDD/Partitions or delete the MBR… yet that’s doesn’t mean that you’ve deleted your data securely.

In those cases we need the help of an expert or a dedicated utility that’s designed to securely delete the data beyond the ability to recover them later (well in the hand of an expert it could still be possible to recover some of it).

GNU/Linux comes with a lot of built in tools that can handle those type of needs but most of them are command-line tools. One in particular method used by these tools is called the “Gutmann 35-pass algorithm” named after the designer, a computer scientist called Peter Guttmann.

But as I was reading his site, I saw he has written that …

This paper is now more than fifteen years old, and discusses disk storage technology that was current 15-20 years ago…If all you want to know about is how to best delete files or data on disk drives using readily-available tools, see the recommendations.

So I went to his recommendations page and found that under GNU/Linux he recommends using another command-line too called “Shred” (comes installed by default in Ubuntu). So, since Mr. Gutmann is a well respected expert in this area, for securely deleting your data in Ubuntu or GNU/Linux in general, then “Shred” seems like a pretty good utility.

But remember, “Shred” only supports wiping out files not folders. So if you have a folder filled with files, then you’d have to use something else. 

Anyhow, the issue here is that it’s it’s a command-line tool. But we can easily create a Nautilus script that would let us run “Shred” from the right-click menu!. This works in Ubuntu 11.10 Oneric Ocelot and should also work in 11.04 Natty Narwhal, 10.10 and 10.04 (even in the below versions).

Instructions…

1. First, open your text editor and copy the below text and paste the content into it and simply save it (you can give any name to it, let’s call it “Destroyer” 😀 in this case).

#!/bin/bash

# Remember, Shred also has its limitations and by no means perfect. For more just read its man page (man shred).

SHRED_PATH=/usr/bin # Path to shred binary.

if dialog=`zenity --question --text “Are you sure you want to shred $1?”`
then
$SHRED_PATH/shred -zu “$1”
fi

*. Note: You can use “Shred’s” built in parameters for additional features (which can be found in it’s manual -- “man shred”). In that case, simply replace the characters in Green above with your own ones so they’ll be executed when you use this script.

2. Now open your “Home” folder and press “Ctrl” + “H” (to make Nautilus show hidden files) and locate the folder: “.gnome2” -> “nautilus-scripts”.

Step 1
Step 2: Now simply go to the inside of this folder…
Step 3: And paste the text file…

If however this “nautilus-scripts” folder doesn’t exists, then simply create it.

3. Now move the text file into that folder. Then right click on it and go to “Properties”. Then under the “Permissions” tab make sure to put a check mark on the option that says “Allow executing file as program”.

This is a necessity!

That’s it. Whenever you wan to delete something securely, just right-click on it and from the menu choose: “Scripts” -> “Destroyer” (or whatever the name that you gave). Now you’re done.

Leave a Comment

%d bloggers like this: