On 18 July 2018 at 00:00, Michael Stone <mst...@debian.org> wrote: > On Mon, Jul 16, 2018 at 03:14:20PM +0200, Dashamir Hoxha wrote: > > > > It writes to `/dev/shm` which is not disk. > > All else that's been said aside, this idea is also dangerously incorrect in > a typical configuration: the tmpfs backend will write to swap under memory > pressure. (This is also true of the memory used by the process; if it's > actually important to keep data from being written to persistent storage, it > should be set unswappable using mlock. I have no idea how one would do this > effectively in a shell script.)
It is possible, but ugly as hell in shell script. I did it in the following old script using foregrounded memlockd invocation, but that was written in shell script only really as an exercise in boredom/masochism. https://github.com/rowanthorpe/safe-key-setup/blob/master/safe-key-setup.sh#L131