I deleted a file I meant to shred first.
$ rm somefile
instead of
$ shred somefile
$ rm somefile
Is there a way to shred a file after 'rm'-ing it?
There is no way to properly securely erase a file with modern filesystems anymore, because the journal can still contain data and there is no reliable way to overwrite the journal.
You can try to disable journalling on the filesystem before deletion, but it won't do anything about data that may already be in the journal from writing the file and not erased. It's not entirely secure.
An ounce of prevention is a pound of cure; it's better to sidestep the issue of needing to shred
the file entirely by encrypting your files using an encrypted volume to begin with. This sidesteps the need to actually shred
your data, so long as you keep your key safe. In a pinch, you could just use dd
to erase the entire volume securely by using a few passes of random data. If you don't want to use full-volume encryption, there is also file-level encryption in ext4 now.
shred
is pretty ineffective these days. Most filesystems have journals, and shread will not clean that. If you are using a journaled filesystem there is pretty much no security advantage in shred.zerofill
? The journal might still be a problem, though.