I am using an Linux Mint Debian Edition. I would like to have a Truecrypt volume (either a file in my home directory or a separate partition) be automatically mounted on login using my login password. Is this possible? If not, how could I make it prompt for a password and mount directly after login?
Debian uses a Sys-V like init system for executing commands when the system runlevel changes - for example at bootup and shutdown time.
If you wish to add a new service to start when the machine boots you should add the necessary script to the directory /etc/init.d/. Many of the scripts already present in that directory will give you an example of the kind of things that you can do.
Here's a very simple script which is divided into two parts, code which always runs, and code which runs when called with "start" or "stop".
Once you've saved your file into the correct location make sure that it's executable by running "chmod 755 /etc/init.d/blah".
Then you need to add the appropriate symbolic links to cause the script to be executed when the system goes down, or comes up.
The simplest way of doing this is to use the Debian-specific command update-rc.d:
If you wish to remove the script from the startup sequence in the future run:
This will leave the script itself in place, just remove the links which cause it to be executed.
You can find more details of this command by running "man update-rc.d".
These are just examples. Just generate your own script to mount the volume and supply the password if you want. Of course if you do that then your password is stored in plaintext on your hdd. You can alter the script to prompt for a password of course.
I think you would need to patch your login program(s) --
Prompting the password after login seems easy enough and more secure. There is just the minor nuisance of typing the password twice for the first login (or login after you decide to automatically or manually unmount the encrypted volume).
What the answer exactly looks like depends on your method of logging in. Each graphical desktop system probably have somewhat different method of specifying program to run. How to run commands as part of the login to your favorite GUI Desktop system is worth another distinct question. Essential to your current question is that you could create a script to check whether your Truecrypt volume is mounted and if not then mount it, and configure your login to run this script that would would look something as simple like the below:
For login to virtual console, you could run the same script in your
You probably know already what the commands to mount Truecrypt volume and check for Truecrypt volume presence are.