Reliably determining that the agent is available and starting it if not

Werner Koch wk at gnupg.org
Fri Feb 22 09:15:23 CET 2013


On Fri, 22 Feb 2013 01:21, craig at 2ndquadrant.com said:

> I expected it to be simple to make sure that the a GPG agent (either the
> "gpg-agent" program or something like Gnome's built-in agent) were

Oh please don't use the latter, that is the cuase for a many problems.

You may use gpg-connect-agent for this.  Howeverm depending how GnuPG
has been build gpg2 and gpg-connect-agent both start the agent if they
need them.  This is a far better way then the mess with the envvars.  We
have been doing that for Windows for many years without problems.  On
Unix you only don't want to do that if ~/.gnupg is remotely mounted on a
filesystem that does not support local sockets.

Now, how do you know whether gpg-agent will be started on demand?  gpg
also needs to know this and thus gpg-agent is able to tell you:

  if gpg-agent --use-standard-socket-p ; then
     echo "gpg2 starts gpg-agent on demand"
  fi

> This is neither reliable, clean, nor user-friendly. The only real
> solution would require that I patch gpg to fall back on the well known
> agent socket location if GPG_AGENT_INFO is unset but use-agent is

Either set the default be using

  ./configure --enable-standard-socket && make

or at runtim put it into gpg-agent.conf

  echo use-standard-socket >>~/.gnupg/gpg-agent.conf




Salam-Shalom,

   Werner


-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gnupg-users mailing list