View Full Version : [all variants] start gui app from autofs executable map

March 9th, 2010, 02:39 PM
I guess the real more general question is: "How to start a GUI app on a user's desktop from a script running without a terminal as root?"

I have an automount executable map for SMB mounts. This needs passwords which are stored in files on a truecrypt volume. If the truecrypt volume has not been mounted yet, the passwords cannot be found, so the automount obviously fails.

What I have tried in my auto.cifs script is:

creddir=$(dirname "$credfile")

# if the truecrypt volume isn't mounted, mount it
[[ -d "$creddir" ]] || {
# call the script which mounts the TC volume
/home/user/bin/tc on

The "/home/user/bin/tc" script with the "on" argument simply does

truecrypt $my_tc_filename

When run in a terminal started from the GUI, whether as myself or as root (after sudo -s), the "/home/user/bin/tc" script does start a truecrypt GUI window on my desktop, where I can enter the TC password. That's what I would like to achieve from the automount script.

When the tc script is run from the automount script, it just exits with error code 1. No TrueCrypt window appears.