Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to mount a Truecrypt volume automatically at user login time. This volume is specific for each user.

I'm not sure how to proceed since I'm not extremely familiar with Linux and the various startup scripts involved.

All Truecrypt volumes are located on my network. I already have the relevant /etc/fstab entry to mount the network drive properly.

I'm using Ubuntu 12.04 LTS (in GNOME classic session mode, if this matters, I did hear it does). Truecrypt needs root privileges when mounting a volume. My users have no root privilege, that's an additional difficulty I have.

Thank you.

share|improve this question
How should the user be prompted for the password / keyfile? – poplitea Dec 2 '12 at 13:54
Thanks for your reply. He should not. The mount operation should be completely transparent for the user. – Martin Frank Dec 2 '12 at 13:56
Nobody for this question? Does anybody know if I can configure an upstart script at user login time, with root privileges when executed? – Martin Frank Dec 3 '12 at 18:25
up vote 0 down vote accepted

You can add

truecrypt /home/user/ /home/user/myEncryptedFileFolder <<EOF

to the file .profile in the user's home-directory.
Anything in .profile while be executed everytime the user logs in.


share|improve this answer
Seems like /etc/.profile is a good place, as it is executed with root privileges, thanks. – Martin Frank Dec 14 '12 at 9:29

This would defeat the purpose of Truecrypt unless you are using whole disk encryption. If you do it this way, all the user would have to do is crack the account's password to gain access to the encrypted files. That being said, hopefully the other answer will answer your question.

share|improve this answer
Agreed - doing this, somebody knowing the Linux password of a particular account would be able to read the startup script in which the password is stored, in other words the volume would in effect be protected only with the Linux login password, not with AES. I could live with that. Now that I think about it the main weakness with my original suggestion is the -p option on the truecrypt commandline which makes the password visible to ps. That IS very bad, I admit. – Martin Frank Dec 14 '12 at 9:33
@MartinFrank Keep in mind that Linux passwords are a whole lot easier to crack than TrueCrypt. – cutrightjm Dec 14 '12 at 19:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.