# GPG not remembering passphrase

## chaoscommander

I've Googled for half an hour, found some solutions for Ubuntu that all involve system settings managers I don't have on Gentoo, followed the GnuPG manual on the Gentoo wiki and I still can't figure out what's wrong here. My gpg-agent doesn't remember my passphrase and keeps asking me for it.

Setup:

Thunderbird 31.6.0 with USE=crypt

gnupg 2.0.26-r3

KDE 4.14.3

Steps taken:

put a script autostarting gpg-agent --daemon into ~/.kde4/env

set passphrase timeout to 1800 seconds in ~/.gnupg/gpg-agent.conf

started gpg-agent --daemon manually

restarted Thunderbird

Am I missing something?

----------

## Hu

When you run the agent with --daemon, it prints the environment variables that you must set in order for other programs to use it.  Are these variables being exported to Thunderbird?

----------

## toralf

Shouldn't gpg-agent be started/stopped in with /etc/kde/startup/agent-startup.sh ?

Furthermore I do have set SSH_ASKPASS=/usr/bin/ksshaskpass here too via /etc/env.d/99ssh_askpass . AN FWIW :

```
tfoerste@t44 ~ $ cat ~/.gnupg/gpg-agent.conf

###+++--- GPGConf ---+++###

debug-level basic

log-file socket:///home/tfoerste/.gnupg/log-socket

default-cache-ttl 5400

max-cache-ttl 54000

###+++--- GPGConf ---+++### Sun 19 Apr 2015 11:33:04 AM CEST

# GPGConf edited this configuration file.

# It will disable options before this marked block, but it will

# never change anything below these lines.

pinentry-program /usr/bin/pinentry

no-grab

default-cache-ttl 5400

```

----------

## chaoscommander

 *Hu wrote:*   

> Are these variables being exported to Thunderbird?

 

How can I tell? Once I could set Thunderbird to use/not use gpg-agent, but now it appears to have some kind of autodetection which is (at least GUI-wise) a black box.

I just checked.. running gpg-agent --daemon doesn't cause the variables to be exported, the export command just comes out as output (is that intentional?). I now exported them manually and restarted Thunderbird, but that also didn't do the trick.

 *Quote:*   

> Shouldn't gpg-agent be started/stopped in with /etc/kde/startup/agent-startup.sh ?

 

https://wiki.gentoo.org/wiki/GnuPG#Automatically_starting_the_GPG_agent says both are possible.

What would this have to do with SSH_ASKPASS?

----------

## Hu

 *chaoscommander wrote:*   

>  *Hu wrote:*   Are these variables being exported to Thunderbird? 
> 
> How can I tell? Once I could set Thunderbird to use/not use gpg-agent, but now it appears to have some kind of autodetection which is (at least GUI-wise) a black box.
> 
> I just checked.. running gpg-agent --daemon doesn't cause the variables to be exported, the export command just comes out as output (is that intentional?). I now exported them manually and restarted Thunderbird, but that also didn't do the trick.

 You can tell by inspecting the Thunderbird process environment via /proc or by restarting it with the variables explicitly set, as you did.  Yes, it is intentional that it only prints the commands, because no process can directly modify the environment of another existing process.  If you run multiple gpg operations from the terminal that restarted Thunderbird, does the gpg-agent cache the passphrase for those gpg invocations?

----------

## chaoscommander

I didn't touch anything for a few days (I may have restarted xdm at some point) and now gpg has started caching the passphrase, just as I wanted it to. It could be that restarting xdm was mandatory, but can't really tell if that was the solution because I haven't used Enigmail in the meantime. Anyway, it works, for now.

----------

