Starting gpg-agent from Xsession

Peter Eisentraut peter_e at
Sat Jan 22 11:22:20 CET 2005

I've been experimenting with ways to start gpg-agent automatically from 
Xsession (on Debian, in particular) so that users don't have to modify 
their .xsession or .xinitrc or whatever.

Basically, this would amount to doing something like this 
in /etc/X11/Xsession.d/something (which is sourced by Xsession, so the 
effect is the same), which is mostly analogous to the ssh-agent 

  if [ -x /usr/bin/gpg-agent ] && [ -z "$GPG_AGENT_INFO" ]; then
    eval `gpg-agent --daemon`

The problem that I see, however, is that this does not terminate the 
gpg-agent when the X session finishes (unlike ssh-agent).  I've also 
played with a number of other invocation methods such as --server, 
--no-detach, or invoking the window manager as an argument of gpg-agent 
(which is how ssh-agent does it), without success.

Does anyone have a good idea how this could be accomplished?  Or is it 
not a problem to let the gpg-agent running?  Or is this whole thing a 
bad idea altogether?  Comments welcome.

More information about the Gnupg-devel mailing list