Ubuntu: Console prompt during boot (for truecrypt)



Question:

In short: Please provide me with a up-to-date best practice solution to mount my Truecrypt volumes at boot with secure password prompt! I may accept a answer that has nothing to do with Truecrypt and just shows me how the get some prompt at a boot stage, most likely a Truecrypt command will work at that point as well!

This command can be used to test it.

read -n1 -r -p "Press any key to continue..." key  

I wish to not discuss any Truecrypt or drive related matters, or anything else think you might think are related or could help. I like to get a prompt at boot nothing else.

Is this maybe possible with upstart script? Or do they run in in background as well?

What I tried already:

  1. rc.local - get ignored for whatever reason
  2. KDE start script set to "before login" with my autologin in KDE it get executed in background during KDE load (harddisk symbol) and stops there I see nothing can't do anything but rename the script to get into KDE
  3. .profile - gets ignored (or runs silently in background as well)
  4. KDE start script set to "login" is to late it get executed when the GUI is fully loaded, by backup services (crashplan and dejapub) are already running and don't have the the disk mounted thats setup for backups what leads to things I want to avoid.


Solution:1

I use the following script, which I've added to my Startup Applications, to automount my "favourite" truecrypt partitions upon login and to autodismount them when I logout/shutdown.

When logging in, truecrypt starts and prompts me for my admin password and for the passwords to the truecrypt volumes (with keys if you use them). Note that storing the path to the key in this script is optional - I include it here to show that it can be done.

#!/bin/bash  truecrypt --auto-mount=favorites -k /path/to/truecrypt/keyfile --background-task &    # store the PID of the truecrypt process  tcPid=$!    tcTerm()  {  # unset the DISPLAY  # (otherwise it tries to contact X server which somehow fails during logout)    unset DISPLAY    truecrypt -d  }    # trap signals to this script and unmount  trap "tcTerm; exit 0" 1 2 15  wait "${tcPid}"  exitStatus=$?    # unmount only if truecrypt exited abnormally  if [ $exitStatus -eq 1 -o $exitStatus -eq 2 -o $exitStatus -eq 15 ]; then    tcTerm    rm -f "${HOME}"/.TrueCrypt-lock-*  fi    exit 0  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »