I’ve previously written about how to securely and permanently delete files in Linux and Windows. The programs I mentioned in those tutorials were all command-line baed, but this tutorial will show you how to add a secure-delete option to the contextual menu in Ubuntu and Fedora Linux.
- Install the Nautilus Actions Configuration utility
- Configure the new menu option
- Test it out
- You can use this for anything!
First, install the nautilus-actions package, which provides a graphical utility for editing the Nautilus right-click menu. We’ll use this utility to add the secure delete option. You can install the nautilus-actions package by using the following command:
|sudo yum install nautilus-actions||sudo apt-get install nautilus-actions|
Once installed, you can configure the new menu option.
Now you should have an option in the Preferences menu called “Nautilus Actions Configuration.” This will allow you to specify the new option for securely deleting files from the file manager. Click the “define new action” button (or select it from the file menu). Specify the information as shown below (feel free to use whatever text you want as the label and tooltip; this is up to you!):
Next, click the “Command” tab. This is where you’ll specify what the new menu item will actually do when it’s clicked. As you see below, I am using the shred program as my secure-delete method, which is located at /usr/bin/shred. For the paramters, I need to specify -u in order to have shred delete the file once it’s been overwritten.
Clicking the “legend” button shows that the option to pass a list of files to the commandline is %M. So my full paramters string becomes “-u %M”. You should feel free to customize the command however you like, by reading the manpage for the command you are using, and by referencing the legend to figure out which substitution strings to use. For example, you might want to use the “-z” option for shred, which will use a final pass of zeros, to “hide” that the file has been shredded, or the “-n” option to specify the number of passes to use.
Finally, you’ll want to set the conditions under which the menu item appears. In the “Conditions” tab, I’ve selected for the secure delete option to appear only when files are selected, and to allow it to be used on multiple files at once. Here is how my Conditions tab looks:
With that, double-check that you’ve entered everything correctly, and click “Save” in the file menu.
That’s all you need to do — the only thing left is to test that it works. Find some files you want to shred, or create a few dummy files (obviously don’t use this on data you need to keep!). I used a bash “for” loop to create a few test files, and then opened Nautilus to the directory where I put them.
Selecting them all and right-clicking, I see the secure deletion option. Clicking it and watching in “top” shows that it is working correctly. Those files are gone!
The nautilus-actions utility can be used for more than just adding secure-deletion options to the file manager; you can use it to execute any command-line operation you want. What are some things that you might add to the Nautilus menu? What other file manager hacks do you find useful? Leave your ideas in the comments below!