LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 04: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, 04: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, 04:58 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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, 04:59 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
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, 05: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, 06: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, 06: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, 06:19 PM   #8
propofol
Member
 
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 334

Rep: Reputation: 60
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, 06:26 PM   #9
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 910

Rep: Reputation: 174Reputation: 174
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, 06: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, 07:14 PM   #11
Janus_Hyperion
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, 07:36 PM   #12
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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, 08:10 PM   #13
propofol
Member
 
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 334

Rep: Reputation: 60
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, 10:41 PM   #14
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 910

Rep: Reputation: 174Reputation: 174
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, 12: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



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 02: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 10:12 PM
LXer: Using "shred" to Securely Delete Files LXer Syndicated Linux News 0 02-27-2008 06:50 PM
help with shred m.pass Linux - General 2 09-02-2006 01:03 AM
shred allows only one file Trio3b Linux - Security 5 12-08-2005 12:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:17 AM.

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
Open Source Consulting | Domain Registration