Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I securely erase a file?

Is there a Gem or means of securely erasing a file in Ruby? I'd like to avoid external programs that may not be present on the system.

By "secure erase" I'm referring to overwriting the file contents.

like image 621
Paul R Rogers Avatar asked Dec 14 '11 17:12

Paul R Rogers


1 Answers

If you are on *nix, a pretty good way would be to just call shred using exec/open3/open4:

`shred -fxuz #{filename}`

http://www.gnu.org/s/coreutils/manual/html_node/shred-invocation.html

Check this similar post:

Writing a file shredder in python or ruby?

like image 128
Andrew Kuklewicz Avatar answered Sep 20 '22 20:09

Andrew Kuklewicz