I want to create a file that is only accessible to the process that created it (and potentially its children), and that disappears when the process exits, ideally never persisting the file to disk. As an example, I want to create /mylocation/myfile.txt
, where that file can only be read from the current process, but not any other processes, even from the same user. I am happy to use some magic location other than /mylocation
, e.g. somewhere under /prod/PID
, but it needs to work for any filename.
The background is that I am using an existing library which reads a password from $FOO/mypassword
. Several processes are running under the same user account, but have different secret passwords. I wish to communicate the password to the library securely from the other processes. I appreciate the ideal solutions would user different user accounts or have the library not read the password from a file, but I do not have control over either of those aspects.