Thursday, June 28, 2007

Digg - LINUX: Securely deleting files with shred

Digg - LINUX: Securely deleting files with shred: "For journaling filesystems I sometimes do .... "cat /dev/urandom > DELETEME ; sync ; sleep 1 ; rm -f DELETEME" .

This will fill up most of the empty spaces in the filesystem with random data, and then when it errors out after the fs fills up, it will sync it to disk and clear it back off. Be prepared to leave it overnight. Here I herd cat works better than "dd" because dd tries to use consecutive blocks. cat /dev/zero works several times faster, but isn't as secure, but if I do "cat /dev/zero > DELETEME ; sync ; sleep 1 ; shred -un1 DELETEME" it seems much faster from start to finish.

With shred, technically speaking if you do only 1 pass, someone could take out an electron microscope and try to read other passes on the same track, but in practice the cost to do that could easily be several hundred thousand dollars per drive, so you're probably pretty safe. Also, you should be root when you do this, because the OS seems to save some extra space on the drive for the administrative user. Finally, I would recommend doing a full fsck on your filesystem first and doing it in single user mode. If you fill up a partially damaged filesystem, or one in use by a database app - it could have ugly results."

Great Wipe system for linux. A good way to wipe or shred or otherwise elimate data on a drive. It fills (overwrites) the drive with random numbers then deletes the data. The more times you run this the more secure your erased data will be. This is our future linux / plesk wipe method."