GnuPG agent and non-shell application

Patrick Brunschwig patrick at
Wed Nov 14 09:17:23 CET 2007

Noiano wrote:
> Hi everybody
> I have GnuPg 1.4.6 installed and I have my .gnupg directory as a
> symbolic link pointing to an encrypted partition. As soon as I need
> my keys I mount the encrypted partition and the symbolic link is
> resolved with no problem. The problem is the use of gnupg agent: I
> type gpg-agent --daemon > gpg-agent-info so that the variable
> information are stored to that file. Under my .bashrc I have added
> the following line "source gpg-agent-info" so that the variable is
> correctly set up.
> The problem is the use of gnupg agent with program such as
> thunderbird, kpgp. They cannot see the variable GPG_AGENT_INFO as
> all shells do. I cannot set anything in .xsession because the
> encrypted partition isn't mounted on boot but on demand. Could you
> please tell me a reasonable solution for this matter?

Start Thunderbird (or kgpg) with a wrapper program that checks if
gpg-agent is running and if yes export GPG_AGENT_INFO from your
gpg-agent-info file. I found that gpg-connect-agent is quite nice to do

Something like this should do the job:

source /path/to/gpg-agent-info

gpg-connect-agent <<EOT
/echo OK

if [ $? -ne 0 ]; then
  ## gpg-agent is not running

exec /path/to/thunderbird "$@"


More information about the Gnupg-users mailing list