I have a partition on a hard drive that is encrypted with dm-crypt using a passphrase. What I want to do is have a password prompt pop up when some program tries to read a file within this partitions target mount point.
Eg. I normally mount my dm-crypt volume in the directory /mnt/crypt. When mounted, inside this directory is a "Music" folder which has the file goodmusic.mp3 in it. So the path is /mnt/crypt/Music/goodmusic.mp3.
If I start Clementine and try to play this file without the encrypted volume being mounted, I'll get a "file not found" error.
What I want to do is, when Clementine tries to open a file in this directory (/mnt/crypt), have a prompt pop up that asks for my mount password and mounts the volume. I guess, in order for it to work, the "read" syscall needs to block while the password prompt is shown, so that the read syscall won't report back an error immediately, before I've had a chance to type in my passphrase.
Is this possible?
I've been playing with inotify, but it doesn't seem to support events for non-existing files.