Kevin Kalupson wrote:

I have a curiosity that I would like to indulge.

I'm wondering about deleting a file in a secure manner. Something similar to an NSA or DOD wipe of an entire hard drive. Does anyone know of a utility script to do something like the following or would it be more complicated?:

1)  Obtain the file size that is to be deleted
2) Obtain a string of data from /dev/urandom exactly the size of the file that is to be deleted
3)  Open the file for writing
4)  Over write the file
5)  repeat steps 2-4 n number of times

My major uncertainty is whether or not there is a automatic guarantee that the file will be over written in the exact same spot on the physical HD.

If this is possible, are there differences in file systems that would affect the solution, such as one appropriate method for an Ext3 that would not work for Reiser?

There is no guarantee that a filesystem will write over the same blocks. If you wanted to go this route, I would use debugfs to find and modify the blocks in question. Here is a site about recovery which describes how to find which blocks a file is using: http://www.tldp.org/HOWTO/Ext2fs-Undeletion-10.html

Reply via email to