» Delete files securely with shred
Deleting a file or reformatting a disk does not destroy your sensitive data. The data can easily be undeleted. That's a good thing if you accidentally throw something away, but what if your trying to destroy financial data, bank account passwords, or classified company information. What if you want to clean your computer before selling it for instance?
In this article you will learn how to use a very powerful tool, so be careful, because you could totally mess up your system. I currently use Ubuntu, but this article should work for pretty much any distribution.
About shred
To make sure the data is unrecoverable by anyone, it needs to be overwritten. Ubuntu has got a standard tool for this called shred, you will probably find it preinstalled on your distribution as well.
The shred command lets you delete files or entire hard drives permanently by overwriting the data with random gibberish many times (25 by default). This totally destroys the original data and makes it almost impossible to recover.
Using shred
Shred files
For shredding files you can run shred like this:
shred -z -u -n200 /home/kevin/company_info/*
-z overwrite with zero's the last time, to mask the shred process.
-u means delete when you're done overwriting
-n200 means overwrite 200 times
Shred drives
Some things that I'm going to change for this operation:
- Overwriting 200 times might take too long when overwriting an entire drive, so let's overwrite it 10 times.
- The device itself can't be deleted so the u argument has to leave.
- We need to replace the /home/kevin/company_info/* with your device name, which you could look up by typing df.
- You can always concatenate arguments so I'm going to do that as well.
So now the command could look something like this:
shred -zn10 /dev/hda
This will totally erase everything on your hard drive. It's best to do this from a Live CD, otherwise during the first run, it will begin missing some essential system files (that of course are being overwritten) and you don't want to crash the system before totally destroying all data.
Final remarks
Shred works best on an entire disk because there are journaling filesystems that store duplicate bytes on others places on the disk delete it.
Like this article?
|
Then Digg it! Or use another bookmark button below to show your support & help me spread the word. |
Hot StuffFlaming articles» Survive heavy traffic with you... | RelatedArticles like this one» Block brute force attacks with... |
tags: linux, security
category: How to - Security
read: 4,515 times






tagcloud
#9. Kevin on 24 January 2008
#8. jerry wooten on 24 January 2008
Disk /dev/hda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
... [more]
Device Boot Start End Blocks Id System
/dev/hda1 1 4 32098+ de Dell Utility
/dev/hda2 * 5 9228 74091780 7 HPFS/NTFS
/dev/hda3 9229 9725 3992152+ db CP/M / CTOS / ...
Disk /dev/hdb: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 1912 15358108+ 7 HPFS/NTFS
/dev/hdb2 1913 1974 498015 82 Linux swap / Solaris
/dev/hdb3 1975 2096 979965 83 Linux
/dev/hdb4 2097 4865 22241992+ 8e Linux LVM
Could you give me steps on how to get back to 1 80 HD with XP home edition
Thanks in advance.
#7. Kevin on 17 January 2008
#6. Jerry Wooten on 17 January 2008
#5. Kevin on 17 January 2008
shred -zvn1 /dev/sda
Shredding can take a very long time, so let's first run it (n1) once. And show progress (v) to see what's happening.
#4. Jerry Wooten on 17 January 2008
Acer laptop-Vista installed(can't stand)
Ubuntu newbie- Booted with Ubuntu 7.10 live CD
Opened terminal-typed after ubuntu@ubuntu:~$
... [more] shred -zn10 /dev/sda (screen popped up telling me I had to use sudo command)
typed sudo shred -zn10 /dev/sda (enter)
blinking cursor comes up on next line, is this working
Hear CD drive noise occasionally.
Could you tell me approx how long or did I do something wrong & need to start over.
#3. Bealer on 04 October 2007
Am enjoying Ubuntu. Would be nice if there was a gui for shred. Anyone know of one?
#2. Kevin on 06 August 2007
I really do try to keep all of my articles brief and precise but unfortunately I'm a technician and no writer so sometimes I get carried away a bit ;)
But thanks, means a lot to hear someone saying I got it right this time! :)
#1. Zigzo ZLinks on 05 August 2007
I like how concise this one was.