Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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).

share|improve this answer
    
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 Feb 23 '12 at 10:09
1  
@bambuntu In which case using a file is not sensible. malloc() and clear the memory allocated as required. –  Chris Down Feb 23 '12 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. –  David Schwartz Feb 23 '12 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 Feb 23 '12 at 17:04
    
@bambuntu - You can use it in Python, see here. –  Chris Down Feb 23 '12 at 19:50
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.