Sunday, July 24, 2016

sdelete utility for Linux

sdelete utility for Linux



Preamble

As you know, when you deleting file it's does not delete actually from HDD. On some systems you can restore file by using some special utilities. But what do you need to do when you want delete your file permanently and secure? You can use special utilities.
First of all you need to understand that better way is standard way. So you need to use well known and well analyzed algorithms and standards. No any security through obscurity! (c) Bruce Schneier

Windows OS

If your system is Windows OS - you can use SDelete app by Mark Russinovich. You can find it here:


This utility can delete files, folders and even clean free space on your HDD or flash drives. This utility implements  DOD 5220.22-M std. So, you can be happy and your data will be deleted in secure way.

Linux OS

When you using Linux OS you can use shred utility. But it can delete files only.

When you need delete more than one file or directory you can use my little script sdelete. Which can be found here:


This script can delete files and folders. Also, directories can be deleted recursively, so be very careful when using this utility.

 
Enjoy!

UPD1: from documentation for shred. 

CAUTION: Note that shred relies on a very important assumption: that the filesystem overwrites data in place. This is the traditional way to do things, but many modern filesystem designs do not satisfy this assumption. The following are examples of filesystems on which shred is not effective:
* log-structured or journaled filesystems, such as those supplied with
AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)
* filesystems that write redundant data and carry on even if some writes

fail, such as RAID-based filesystems
* filesystems that make snapshots, such as Network Appliance's NFS server
* filesystems that cache in temporary locations, such as NFS

version 3 clients
* compressed filesystems
In addition, file system backups and remote mirrors may contain copies of the file that cannot be removed, and that will allow a shredded file to be recovered later.

UPD2: easy install

 To install this utility easily you can clone it with git
 $ git clone https://github.com/JFF-Bohdan/sdelete

Note: if you do not have git you can install it using sudo apt-get install git

Then you need make script executable:
$ cd sdelete/
$ chmod +x sdelete

It's will be easy to run this script if you will copy to /opt (system level storage of executable files and scripts):

$ sudo cp ./sdelete /usr/bin/

After this operation you can call it easily from anywhere from system.

Removing installation files:
$ cd ..
$ rm -rf ./sdelete/


No comments:

Post a Comment