Ask Your Question
2

how to securely and permanently delete a file? [closed]

asked 2011-09-29 00:33:39 -0600

shanks gravatar image

updated 2011-09-29 01:28:11 -0600

mether gravatar image

How to delete a file in linux securely and permanently, so it can never be recovered?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by zoltanh721
close date 2014-06-27 17:41:14.439063

4 Answers

Sort by » oldest newest most voted
2

answered 2011-09-29 00:59:57 -0600

shanks gravatar image
$ yum install srm
$ srm myfile.txt

srm removes each specified file by overwriting, renaming, and truncating it before unlinking.
This prevents other people from undeleting or recovering any information about the file from the command line.

Instead of just overwriting your files with random data, it uses a special process – a combination of random data, zeros, and special values developed by cryptographer Peter Gutmann – to really, really make sure your files are irrecoverable.

edit flag offensive delete link more
3

answered 2011-10-04 01:47:03 -0600

tezcatl gravatar image

It's interesting too scrub, and very useful if you want to, well, scrub deeply a file, a whole partition/disk before creating an encrypted partition, or your free space. And it is actually very fast.

edit flag offensive delete link more
1

answered 2011-09-29 04:48:50 -0600

satyaakam gravatar image

or use the command shred

edit flag offensive delete link more
0

answered 2011-11-16 18:22:01 -0600

bct gravatar image

updated 2011-11-16 18:23:52 -0600

As tezcatl says scrub and dd are good choices. If you're wiping a whole disk make sure to change the bs=BYTES option (see `man dd') and experiment a little (depends on the HDD), as this can speed the process up e.g.

dd bs=8M if=/dev/zero of=/dev/hdd

There is also no need to overwrite something more than once [1].

[1][https://en.wikipedia.org/wiki/Gutmann_method#Criticism](https://en.wikipedia.org/wiki/Gutmann_method#Criticism)

edit flag offensive delete link more

Comments

This is actually a good option on solid state media like USB pendrives, however I wonder if forensics software like Photorec [1] could recover the "erased" file in this type of media.

[1]http://www.cgsecurity.org/wiki/PhotoRec

tezcatl gravatar imagetezcatl ( 2013-07-04 20:28:43 -0600 )edit

It could not. It's possible that organizations like the NSA could recover it if they wanted the data badly enough and could spend a bunch of money working on it and it was only overwritten once, especially with just zeros, but that will certainly foil any recovery software.

As for the "Gutmann Method", yes, you don't need 35 passes, but I would not trust 1 pass with zeros to foil the NSA. (But it would make their job hard.) Maybe two passes with random data would foil them completely, however.

dougmc gravatar imagedougmc ( 2014-03-09 00:02:25 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2011-09-29 00:33:39 -0600

Seen: 5,833 times

Last updated: Feb 09 '12