LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-08-2013, 05:17 PM   #1
tony00
LQ Newbie
 
Registered: Jul 2013
Posts: 7

Rep: Reputation: Disabled
Post How to Shred Files!


Hi,

We are going to be changing servers shortly and want to destroy the data on our old server before we give it back. We have 2 x 250GB configured in RAID

Would be useful if we could have:

A. A command we can use to shred the data one directory at a time.
B. A command to shred/wipe the complete drive.

Thanks for any help!
 
Old 07-08-2013, 05:51 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Download Darin's boot and nuke. Do a DOD wipe on it, takes 7 passess writing straight 0's and 1's to the drive. THIS IS NOT A GUARANTEE! Data could in theory still be recovered but it would take the will of some super guru locked up in the NSA's basement.


However, this is very very standard. While working for one of the top level finance companies who held social security numbers, bank account numbers etc.. we would do a DoD wipe then physically shred the drives. Its the equivalent of taking a piece of paper that has writing on it and blacking it all out with a sharpie, you cant see it but the original stuff is still there, so then you take that blacked out piece of paper, light it on fire and bury the pieces at the four corners of the world. Well a little extreme but you get the idea.


http://www.dban.org/
 
Old 07-08-2013, 05:58 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
If you've got any form of remote management (IPMI, iLO, DRAC or whatever else TLA or FLA in use) that allows you to boot an ISO or DVD load up DBAN (quick wipe with verification pass should prove to be "good enough" most of the times). Else load any other Live CD, bootable USB stick, or perform the 'dd if=/dev/zero of=/dev/whateverraiddevice' from within the system as that could be entertaining too ;-p *Note that for any device processed I do not consider the wiping process finished until verification is done (easier if you write a pattern or zeroes).
 
Old 07-08-2013, 05:59 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,358

Rep: Reputation: 1990Reputation: 1990Reputation: 1990Reputation: 1990Reputation: 1990Reputation: 1990Reputation: 1990Reputation: 1990Reputation: 1990Reputation: 1990Reputation: 1990
When I'm disposing of a drive that contains sensitive information, I physically disassemble it and smash the platters into a million pieces with a hammer.

:shrug:

If you need the drive in-tact, then go with dban
 
Old 07-08-2013, 06:04 PM   #5
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
OR... http://thehacktory.org/wp-content/up...g-printer.jpeg
 
Old 07-08-2013, 07:08 PM   #6
tony00
LQ Newbie
 
Registered: Jul 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
This is a remote server so I dont think any of your suggestions will be posible, we dont have physical access to the drive.

I was looking for something more like a Linux command that could be run that would be a bit more secure than just rm
 
Old 07-08-2013, 07:15 PM   #7
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
If you do not have physical access to the drive then wouldn't it be safe to assume that you are not responsible for maintaining your hardware and that you are paying a company or someone to do so, if thats the case and it is pretty common, then data erasure and all that should be written into the statement of work or contract.


Without access to the drives or being able to boot from an iso you only have access to the linux utilities.


Now you could do unspawns suggestion of using /dev/zero and dd to write zeros to a device but if that device is teh one you are currently running the OS off of it will only get to a certain point before the OS becomes unusable and would not be an acutal wipe.
 
Old 07-08-2013, 07:19 PM   #8
propofol
Member
 
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 331

Rep: Reputation: 59
Quote:
Originally Posted by tony00 View Post
Hi,
A. A command we can use to shred the data one directory at a time.
How about just:
Code:
cd /path/to/
rm -rf folder
#Clear free space with
dd if=/dev/zero of=./file bs=16M
sync
rm file
For a drive: sudo dd if=/dev/zero (or random) of=/dev/sdX. It's not called Destroyer of Disks for nothing. This will probably work better if /dev/sdX is not the root drive. This may not be the ultimate way of wiping data but it would certainly make recovery somewhat expensive.

Regards,
Stefan
 
Old 07-08-2013, 07:26 PM   #9
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 835

Rep: Reputation: 165Reputation: 165
Quote:
Originally Posted by tony00 View Post
A. A command we can use to shred the data one directory at a time.
Use shred in combination with find.

Code:
find <path-to-directory> -type f -execdir shred -u {} \;
Shred only works on files, not directories, so you'll need to use remove the directories manually.
 
Old 07-08-2013, 07:27 PM   #10
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Stefan


I don't use dd often but can you clarify your post a little here?

Wouldnt:

Code:
dd if=/dev/zero of=./file bs=16M
Continue to keep writing 16 Megabytes to the ./file until the drive ran out of space or the command was cancelled? I know that I get my dd options mixed up sometimes and the man page didnt help clarify it very much.
 
Old 07-08-2013, 08:14 PM   #11
nonamedotc
Member
 
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 372

Rep: Reputation: Disabled
Before dd, you could perhaps write a script that includes shred.

man shred will tell you that

Quote:
NAME
shred - overwrite a file to hide its contents, and optionally delete it

SYNOPSIS
shred [OPTION]... FILE...

DESCRIPTION
Overwrite the specified FILE(s) repeatedly, in order to make it harder for even very expensive hardware probing to recover the data.
After that, dd if=/dev/zero .... would be perfect! May be.
 
Old 07-08-2013, 08:36 PM   #12
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
Quote:
Originally Posted by tony00 View Post
This is a remote server so I dont think any of your suggestions will be posible, we dont have physical access to the drive.
Then you should have stated so in your OP. Efficiency and all that.


Quote:
Originally Posted by tony00 View Post
I was looking for something more like a Linux command that could be run that would be a bit more secure than just rm
Remove the files then run 'dd' as propofol suggested (running 'shred' and then 'dd' gives you nothing extra). Again, verify (or have personnel verify) the disks content after the op. Without post-op verification any "secure deletion" makes no sense at all.
 
Old 07-08-2013, 09:10 PM   #13
propofol
Member
 
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 331

Rep: Reputation: 59
Quote:
Originally Posted by Kustom42 View Post
Stefan
Continue to keep writing 16 Megabytes to the ./file until the drive ran out of space or the command was cancelled? I know that I get my dd options mixed up sometimes and the man page didnt help clarify it very much.
The aim is to overwrite the free space where your files used to be with zero's or random numbers (/dev/random). With just a "rm -rf folder" only the reference to the file is removed. The "bs=16M" is just to speed things up - dd still writes until the drive is full even if the last block is not a full 16Mb.

Regards,
Stefan
 
Old 07-08-2013, 11:41 PM   #14
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 835

Rep: Reputation: 165Reputation: 165
What about backups? Were they under your control, or was the owner of the system making its own backups? If the latter, you need to ensure that those are destroyed as well.
 
Old 07-09-2013, 01:11 PM   #15
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Quote:
Originally Posted by propofol View Post
The aim is to overwrite the free space where your files used to be with zero's or random numbers (/dev/random). With just a "rm -rf folder" only the reference to the file is removed. The "bs=16M" is just to speed things up - dd still writes until the drive is full even if the last block is not a full 16Mb.

Regards,
Stefan
If the drive you are writing to is apart of the root filesystem this would not work, it would hit a certain point where it would just fill up the filesystem, all of the data would still be recoverable if you pulled the drive and mounted it as asecondary drive on another system.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Shred mosthigh Linux - Software 1 12-13-2010 03:08 AM
LXer: Shred and secure-delete: tools for wiping files, partitions and disks in GNU/Li LXer Syndicated Linux News 0 12-02-2008 11:12 PM
LXer: Using "shred" to Securely Delete Files LXer Syndicated Linux News 0 02-27-2008 07:50 PM
help with shred m.pass Linux - General 2 09-02-2006 02:03 AM
shred allows only one file Trio3b Linux - Security 5 12-08-2005 01:58 AM


All times are GMT -5. The time now is 03:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration