I am trying to make a script that will mount an encrypted volume (dm-crypt / luks) with a password that is passed as argument to that script.
My trouble is that I can't find a way to make that script work ...
For instance, when I run this :
mount /my/encrypted/path > file.txt 2>&1
it still shows me the password question outside the script and let me type the password .... It's just like the mount command found a way to escape the redirections that I've set ....
So it's impossible for me now to input a password due to the fact that the part that ask me the password runs outside my script .....
How mount found a way to escape redirection ? I don't know.
Do I have to change some configuration file ? I don't know.
Is mount has some luks specific commands ? I don't know.
How can I mount an encrypted volume via a script without having "human" interaction with my script (aka : my script type the password) ?
I know that what I try to achieve may represent a security risk .... but the password will be transferred in a secure way to the script (so do not care about the potential security risk that it can involve).
In case this matters : I try to achieve this under Ubuntu 64bit 11.10.