Slashdot Mirror


Why 'rm -R star' Isn't Enough

zdburke writes: "Short but interesting article in the New York Times (free reg req'd) about how difficult it is to cover your digital tracks because electronic documents are so well distributed -- on your lap top, on your workstation, on the server... Yes there are tools to thoroughly delete files on your computer, rather than just unlinking them when they're put in the trash, but it's the distributed nature of content these days that poses a special problem to the Ollie North's of the world."

38 of 396 comments (clear)

  1. addition by PHanT0 · · Score: 2, Informative

    I always like to add the "f" right after that "-R"...

    That good enough for ya? :>

    1. Re:addition by transient · · Score: 2, Informative

      I always like to add the "f" right after that "-R"...

      The only thing -f does is delete files without asking. That's good for getting rid of large numbers of files, but it won't overwrite any of the data.

      If you're using a BSD box (MacOS X included), you can use -P. On Linux you can use srm.

      --

      irb(main):001:0>
  2. Undeleting files on *nix by Sobrique · · Score: 5, Informative

    It's quite possible to recover files, because, much like PCs nothing actually gets 'deleted'. The inode is marked as 'available for reuse' and removed from the directory entry, but doesn't actually remove anything.
    Looking for an undelete? Take a look at the coroners toolkit. There's even instructions on how to recover files from a unix partition (any unix). It's one of those ones which you'd _really_ need to recover the data because it's hard work and a pain, but it is possible.
    I don't recall seeing and 'write with zeros' program for Unix. I guess there must be some out there, since at a guess it's fairly trivial. (would dding /dev/zero over a file just prior to erasing it work?)
    Of course, there's always disk analysis with an electron microscope, which I've always heard was possible but it's not one I've ever had substantiated.

    1. Re:Undeleting files on *nix by Sobrique · · Score: 4, Informative

      And for those who noticed, I can't type URLs, so here it is again :) http://www.porcupine.org/forensics/tct.html

    2. Re:Undeleting files on *nix by jelly69 · · Score: 2, Informative

      Please check your link. Should be coroners toolkit [www.porcupine.org]

      --
      |This space for rent|
    3. Re:Undeleting files on *nix by Anonymous Coward · · Score: 5, Informative

      I take it you haven't met shred

      NAME
      shred - delete a file securely, first overwriting it to
      hide its contents

      SYNOPSIS
      shred [OPTIONS] FILE [...]

    4. Re:Undeleting files on *nix by AnalogBoy · · Score: 2, Informative

      For Everyone's benefit, the link is The Coroner's Toolkit

    5. Re:Undeleting files on *nix by metlin · · Score: 3, Informative

      Why go that far? Even good old Norton Midnight Commander can do an undelete of the files on Linux.

      It had troubles with the 2.0.x series, where only the first few blocks could be recovered, but as of 2.1.x & upwards, it works like a charm on ext2.

      I'm sure there would be other utilities capable of this for other platforms. There was also this old program for Solaris (whose name I've forgotten) that'd do just what you'd said to restore deleted files.

    6. Re:Undeleting files on *nix by image · · Score: 4, Informative

      Try using BestCrypt from Jetico -- it works on Un*x and Windows. This is a great tool for creating a mountable encryted filesystem (just about every algorithm under the sun is supported, including 3DES and Blowfish).

      Also included (which is why this reply is relevant) is the bcwipe utility, which does Department of Defense recommended (5200.28-STD) deletion.

      It isn't "free-as-in-speech" but it does have a "free-as-in-beer" evaluation copy.

      Check out:

      http://freshmeat.net/projects/bestcrypt/

      and

      http://www.jetico.com/linux.html

    7. Re:Undeleting files on *nix by blibbleblobble · · Score: 1, Informative

      Presumably PGP runs on unix? That has a file-wipe utility, a freespace-wipe utility, and the possibility of creating encrypted disks.

      At least, it does on windows - I hope I'll still be able to use it when I switch to linux next week.

      (Wipe = overwrite data between 3 and 30 times with random data, and *then* unlink it)

    8. Re:Undeleting files on *nix by szomb · · Score: 2, Informative

      I don't recall seeing and 'write with zeros' program for Unix.

      RM(1) FreeBSD General Commands Manual RM(1)
      ...
      -P Overwrite regular files before deleting them. Files are
      overwritten three times, first with the byte pattern 0xff,
      then 0x00, and then 0xff again, before they are deleted.

      Hope this helps

      --
      Just because a few of us can read write and do a little math, doesn't mean we deserve to conquer the universe
  3. PGP by iGawyn · · Score: 5, Informative

    If you are concerned enough about your data to want to permanently delete it, or at least keep your tracks covered, you'll use PGP and either wipe your freespace multiple times to completely obscure data, and/or keep your important files encrypted.

    Although encryption is, in theory, breakable, the resources to do so don't exist (unless the NSA has some quantum computers squirreled away somewhere), your files will be safe.

    In short, if you want to keep files private, use PGP, and use it wisely. If you don't make more of an attempt, other than "well, if I tell Windows to delete it, it's gone", to keep files hidden/gone for good, you deserve to have your data recovered.

    Gawyn

  4. No registration required by Anonymous Coward · · Score: 1, Informative

    http://archive.nytimes.com/2002/01/14/technology/e business/14DELE.html

  5. On the opposite side on the coin by Nailer · · Score: 5, Informative

    Yes there are tools to thoroughly delete files on your computer, rather than just unlinking them when they're put in the trash, but it's the distributed nature of content these days that poses a special problem to the Ollie North's of the world.

    Well, I don't think any OS has ever been short of undeletion tools - in unix, one can grep the inodes on a disk for a particular known string of a file and recover it fron a known template. Tools like gpart (a partition guesser) also easily recover those vital 512 bytes of your hard disk.

    Where Unix has been lacking, behind most other systems, is the opposite - a good, reliable, trashcan. It might be interesting to note that there's now a reliable trashcan for Linux, BSD and other glibc systems th simply preloads and wraps unlink, `move and a couple of other system calls.

    Since glibc is a part of the Linux Standard base, it works along with every LSB standard app. Even better, it doesn't matter whether you delete the file from KDE, GNOME, shittyunixtoolkitforhellcirca1980something or a terminal.

    Anyway, check out Libtrash. And if you're a GNOME or KDE hacker, I'll give you a big hug if you use this as the default trashcan or your next release. :D

  6. Re:Electron Microscope by Calle+Ballz · · Score: 3, Informative

    for the most part, you don't even need to take the hard drive apart to do this. I have seen and even once had the oppurtunity to use a forensic computer that had the ability to scan through the hard drive, and determine just about anything that had been deleted, wiped, or over written. It has the hard drive read the magnetic echo left on each sector. The machine is mostly used as evidence against kiddie porn fuckers to prosecute them. I didn't really believe it until I see it... so anything I don't want seen... I shoot it with my 12 guage (repeatedly). Seriously.

  7. Re:Not a problem... by tkrabec · · Score: 2, Informative

    Depending on the level of "security" you are looking for overwriting a file is not good enough. With proper analysis files can be recovered when they have been over written several times. This is expensive and time consuming, but it can be done.

    -- Tim

    --
    TKrabec Pahh
  8. Link for non-registered users by El+Linuxero · · Score: 2, Informative
    --
    --El Linuxero
  9. Re:Does anyone really have a problem with this? by peripatetic_bum · · Score: 4, Informative

    Actually, the idea that just because you have nothing to hide means that you shouldnt have the ability to hide something is an interesting fallacy.

    Foucalt was a 60's "post-modern" French philospher who studied how systems of control are used to keep a Power in place. One of his most interesting insights was the more you can observe something the more the you can label it, quantify it, and more important the easier it becomes to define a Norm. Once you have a defined a norm, you know have the means to control the subject you were initally just merely observing.

    I think this is a case of being able to keep something from observation, ie keep it away from ouside powers

    anyway, thanks

    --

    Sigs are dangerous coy things

  10. rm -RP * on *BSD systems by redelm · · Score: 4, Informative

    Of course `rm -R *` isn't enough -- it just unlinks files, but doesn't delete datablocks. To delete datablocks, try the -P option which overwrites the file data before unlinking. Unfortunately, this option is not available on GNU `rm` which is used on most Linux systems.

  11. Nitpicking by jawtheshark · · Score: 2, Informative
    You shoudn't call it "Norton Midnight Commander". There is a "Norton Commander" (old DOS proggy) and there is " GNU Midnight Commander"" which you could call the Linux clone.

    Norton has nothing to do with Midnight Commander.

    --
    Ahhh...the great dumpster continuum. Many a free computer will be found there. -- sowth (748135)
  12. Use shred Instead by exor · · Score: 2, Informative

    shred -f *.*
    It kill DATA DEAD

    1. Re:Use shred Instead by whovian · · Score: 5, Informative

      The man page for shred says

      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 mod
      ern 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, etc.)

      Using shred on ext3 does not seem to be a good idea. I use srm instead. srm overwrites the data 30+ different times using bit patterns and random patterns. The high number of overwrites is supposed not only to allow for slight deviations in alignment betweeen the drive heads and track on the platter, but also meets some very high (you might say "federal") standards, short of (or in some cases, followed by) incinerating the disk.

      --
      To-do List: Receive telemarketing call during a tornado warning. Check.
    2. Re:Use shred Instead by Tim+C · · Score: 3, Informative
      Unless you use a journaling filesystem. From the man page:


      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, etc.)


      There are a few other caveats, but that's the important one for me, given that I upgraded my machine at the weekend and only yesterday reinstalled Mandrake 8.1 with reiserfs for both my / and /home partitions...

      Cheers,

      Tim
  13. Re:Mirrors by Fjord · · Score: 3, Informative

    That is a terrible example. Snopes has a good article explaining the problems with using pencils (the inhalation and electrical problems, as well as fire hazards in a pure oxygen environment made wood pencils problematic). It also explains that NASA never paid for the R&D, both Americans and Russians used graphite pencils in the beginning and both Americans and Russians switched to Fisher Space Pens. Also it gives the cost of 400 pens NASA initially bought: $2.95 each (granted that was in 1967 dollars).

    --
    -no broken link
  14. GNU shred by suso · · Score: 3, Informative

    There is a program called shred that comes with most distributions nowadays that overwrites the files with different patterns before unlinking them. There was something about this on Slashdot a while ago. This program seems to use a simular algorithm.

  15. Use GnuPG by yerricde · · Score: 3, Informative

    Presumably PGP runs on unix?

    PGP 6.5.8, the last freeware version

    GnuPG 1.0.6, the GNU Privacy Guard, is a free implementation of the OpenPGP spec.

    --
    Will I retire or break 10K?
  16. FreeBSD has rm -P by seanadams.com · · Score: 5, Informative

    On some systems, rm has an option to nuke the contents of the file before unlinking it:

    man rm
    <snip>
    -P Overwrite regular files before deleting them. Files are overwritten
    three times, first with the byte pattern 0xff, then 0x00, and then 0xff
    again, before they are deleted.
    </snip>

    You can just put "alias rm rm -P" in your login script to make this the default.

  17. Time required to erase a 20 GB drive by yerricde · · Score: 3, Informative

    Considering most systems come with 15-60gig drives now, it would take a long time to actually write over all the sectors used for that file in its entire lifetime.

    No longer than a couple defrags. Simply open thousands of multimegabyte files, and then in each file, write a layer of 0's, a layer of 1's, and a couple layers of random data, and you're pretty safe. Five passes on a 20 GB partition shouldn't take more than a few hours depending on the transfer rate from computer to drive.

    --
    Will I retire or break 10K?
  18. Hence, GNU shred from fileutils,standard on GNU OS by fsmunoz · · Score: 5, Informative
    Of course `rm -R *` isn't enough -- it just unlinks files, but doesn't delete datablocks. To delete datablocks, try the -P option which overwrites the file data before unlinking. Unfortunately, this option is not available on GNU `rm` which is used on most Linux systems.
    It would be trivial to add that to GNU rm, but it's futile since there is another gnu tool for this purpose called GNU shred.
    From the GNU shred info node:
    shred overwrites devices or files, to help prevent even very expensive hardware from recovering the data.

    Ordinarily when you remove a file (*note rm invocation::), the data is not actually destroyed. Only the index listing where the file is stored is destroyed, and the storage is made available for reuse. There are undelete utilities that will attempt to reconstruct the index and can bring the file back if the parts were not reused.


    GNU shred is very featerful, as costumary in GNU utils, and has many flags to modify the behaviour.

    BSD ppl are always praising the 'Unix Way' of small utilities that do a very defined job and nothing more, and hate the extended features that GNU utils provide; in this case it's BSD rm that is doing something that could be done by another tool by adding a flag! Horror!

    Seriously, GNU shred is a good tool, and it can receive some interesting flags that a simple rm -P doesn't support.

    cheers,
    fsmunoz
  19. Re:All you need to do is... by gimple · · Score: 3, Informative

    Apparently, this isn't 100% effective:

    Contrary to conventional wisdom, "volatile" semiconductor memory does not entirely lose its contents when power is removed. Both static (SRAM) and dynamic (DRAM) memory retains some information on the data stored in it while power was still applied. SRAM is particularly susceptible to this problem, as storing the same data in it over a long period of time has the effect of altering the preferred power-up state to the state which was stored when power was removed. Older SRAM chips could often "remember" the previously held state for several days. In fact, it is possible to manufacture SRAM's which always have a certain state on power-up, but which can be overwritten later on - a kind of "writeable ROM".

    This is from Peter Gutmann's paper Secure Deletion of Data from Magnetic and Solid-State Memory

  20. Re:Mirrors by _DMan_ · · Score: 2, Informative

    why don't you just overwrite the file with the same name, just some bogus data

    This method does not ensure that any of your data is actually overwritten because the operating system is free to decide where on the disk it locates a file (or portions of it). Even though the filesystems references to that file name are destroyed by this method, the user has no guarantees that the data in the original file is overwritten. This is especially true in the case of remotely mounted filesystems which may not even implement the type of filesystem they appear to (e.g. Samba on Linux looks like it implements a MS filesystem).

    This is the major shortcoming in most of the "secure delete" tools I have looked at.

  21. Largely Irrelevant by dh003i · · Score: 5, Informative

    For most of us here, the gov'ts electron-microscope method of determining old data is irrelevant. How many of you here think that it'll be employed against you? That said, I suppose for those of us who engage in a big-time trading of files via P2P networks, & DeCSS, etc, there's always the possibility of criminal prosecutions. So, let me go over the 3 types of "data deletion", and say where each should be used:

    1. Typical deletion. Files are unlinked with their directories, so your OS does not "see" them and has more space available to write with. If the information is not sensitive, or you don't fear intrusion, this is the fastest, and also best, method of deletion. It simply changes the first character of a file name do something that your OS doesn't recognize -- a very fast process. The Advantage: data is recoverable via a data-recovery utility. The Disadvantage: the data has not been securely eliminated.

    2. Simple once-sweep wipe-over deletion. Either random 1s and 0s, or wholly 1s, or wholly 0s, are written over an entire file. Use this for data that is sensitive, or where you fear cyber-intrusion by hackers. The Advantage: data is securely eliminated, beyond the reach of anyone who hacks into your computer. The Disadvantage: data is irrecoverable to you, should you realize you made a mistake, and this process is slower.

    3. A multi-sweep wipe. Same as above, but many sweeps are performed, enough to make typical electron-microscopy methods of data-recovery inviable. This method effectively makes data irrecoverable by any means. Electron microscopes can detect "old zeros" by ghost-patterns, a slight trace. But if data has been written over many times, the older data is impossible to recover even by those methods. The Advantage: this method securely removes the data, beyond the reach of any technological means. The Disadvantage: this method is very slow, and again, data is irrecoverable should you learn you made a mistake.

    It should be noted that whenever you want to securely delete data, not only do you need to wipe the file, but you also need to wipe your swap files and your temporary files.

    So, let me summarize when each of the methods of "data-removal" should be used, starting with the strongest method (a multi-sweep wipe), and ending with the weakest method (the renaming of the first filename character to something unrecognizable):

    1. A multi-sweep wipe. Use this when you have data on your computer that could be used against you in a lawsuit or prosecution. For example, certain kinds of pornography, copyrighted files, warez, and other various information that's been deemed "illegal" by the Information Police in the MPAA, RIAA, MS, and the US Gov't.

    2. A single-sweep wipe. Use this for information that is sensitive, but that you need not fear should the government get ahold of. For exmaple, financial files, files containing credit-card information, etc -- anything you'd want to protect from online-hackers using data-recovery programs. The government, though draconian, has not been known to steal people's credit cards using electron-microscopy. Similarly, hackers have not the resources to use electron-microscopy to acquire your credit cards -- nor would it be worth it. However, if your a high-tech company selling your computer equipment to another company, a multi-sweep delete of your files may be necessary to protect your information from competing companies, who may have bought your machinery through another company as a front.

    3. A deletion that dissociates the file from the directory (renames the 1st character). Use this for non-sensitive data. For example, stories you've written, calendars, lists, ideas, old programs, pictures, etc etc.

    Hope this has been helpful -- and please, remember, if you want to securely remove sensitive data either by a single-sweep wipe (to protect it from hackers) or a multi-sweep wipe (to protect it from the government), please remember to also securely remove swap files and temporary files as well!

  22. Try using "obliterate" by gmcraff · · Score: 3, Informative

    FreeBSD users have the program obliterate in the sysutils part of the ports collection. It takes pains to overwrite the data in order to make sure the file, even if re-linked, is unusable.

    If I understand correctly, it open the file for writing multiple times first. First it writes 0s, then 1s, then alternate beginning 0s and 1s, then 1s and 0s, then patterns of 1s and 0s of all descriptions, then several passes from /dev/rand.

    The upshot is that even if you find the inode and relink to the data, it's been overwritten so many times than you really can't possibly recover it even using forensic methods.

  23. Re:That's why I own by Wansu · · Score: 3, Informative

    A big 'old electromagnet.
    Degauss the disk and it's gone for good


    Could you describe this big 'old electromagnet?

    I've tried this with speaker magnets and bulk tape erasers like Radio Shack sells and they didn't erase floppies, zip disks or hard drives. In fact, it didn't seem to do squat to them. If you have a electromagnet that will, I'd like to know how it's made.

    --
    Wansu, th' chinese sailor
  24. How about shred? by Anonymous Coward · · Score: 1, Informative

    I always use the shred program that comes with my linux disto (Mandrake, but I think Red Hat also comes with shred). It's a great program, has many command line arguments and options, and is designed specifically to thwart those disk analysis techniques that you talk about.
    Here's what I do: shred -fuzv *

    The only problem is that there is no 'recurse' flag, so if you have an entire subtree that you want to erase, you have to manually 'cd' to each directory, and then 'shred -fuzv *'.

  25. Don't just delete by einhverfr · · Score: 3, Informative

    dd if=/dev/zero of=/dev/hda works for me ;)

    Repeate 4 or 5 times, and good luch recovering anything...

    --

    LedgerSMB: Open source Accounting/ERP
  26. The obligatory rubberhose mention. by StormySky · · Score: 2, Informative

    Worrying about wiping isn't as big of a deal if you make the data indecipherable in the first place. :-) Check out rubberhose for more information: Basically an encrypted file system that's free and gives deniability. Who cares about file echoes when they're all chaos?

    --
    We can face anything... except for bunnies.
  27. Re:Not a problem... by Alsee · · Score: 4, Informative

    a large number of passes from /dev/random would in fact solve the problem.

    Nope. The longer data is on the disk the "wider" it gets. A large number of /dev/random writes will thoroughly scramble a "narrow" stripe. You would have to wait a long time between each pass - each wait would have to be about as long as the original data was on the disk. Even then you have to worry about the write head drifting off center and leaving traces of your data off to one side. Even a BFM (big magnet) leaves traces of the data.

    This is why the Govt requires that any disk that ever contained classified data must be INCINERATED.

    -

    --
    - - You can't take something off the Internet! That's like trying to take pee out of a swimming pool.