I'm running a live distro in ram. I need to write a password to a file. Later, I need to delete it securely.

I don't know how live file systems work, so I'm unsure if I open the file for writing, then write over it with data the length of the password, if it actually will write over that exact memory location or not. The goal is to securely delete the file by writing over it.

I don't know if journaling happens in Live Linux distos. If so, is it possible to create a virtual file system in ram? I could then just write the password there and dd will securely write from beginnig to end of the volume.

What are my options?

1 Answer 1


Journalling depends on the filesystem being used, but if you're using a live Linux distribution, there usually isn't any persistence by default (with some exceptions). If your filesystem is journalling (check /proc/mounts to find out which filesystem is being used) I would not rely on anything to try and "securely delete" a file (unless that filesystem is entirely in memory, in which case the data will be lost shortly after the RAM loses power).

If you want to be safe, mount a ramfs (not tmpfs as this may swap!) filesystem and write it there. The data will be lost entirely once the RAM has lost charge (if you're paranoid, leave it unpowered for a minute or so).

  • This password file is created at boot. At this point, the user will begin a session of unknown length using on-line services. The password is associated with several accounts. It's more about making sure the file is securely deleted during the live session, rather than the ram after shutdown. In fact, the password will be useless if it is retrieved after shutdown, because a new one will be created at next boot. So, I really needed it cleared right before some major on-line use.
    – bambuntu
    Commented Feb 23, 2012 at 10:09
  • 1
    @bambuntu In which case using a file is not sensible. malloc() and clear the memory allocated as required.
    – Chris Down
    Commented Feb 23, 2012 at 10:16
  • I agree with Chris. A file is not the right way to store this. Use a storage system that has the semantics you need -- filesystems don't. Commented Feb 23, 2012 at 12:17
  • Oh, yes. I forgot about c. I'm using python and I don't know if there is a malloc() equivalent. But that's the answer. Thanks.
    – bambuntu
    Commented Feb 23, 2012 at 17:04
  • @bambuntu - You can use it in Python, see here.
    – Chris Down
    Commented Feb 23, 2012 at 19:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .