--homedir in gnupg 2.1

Werner Koch wk at gnupg.org
Tue Apr 22 14:10:39 CEST 2014

On Mon, 21 Apr 2014 18:13, nicholas.cole at gmail.com said:

> Currently, for a lot of testing I want a completely blank setup.  I
> simply set --homedir to a temporary directory, and avoid affecting any
> existing public or private keyrings.

I do it this way:

  $ cd foo
  $ GNUPGHOME="$pwd" gpg-agent --daemon bash

and use that new shell for testing.  If you are done with it an exit
shuts down the agent after some seconds.  As usual watchgnupg in another
xterm is quite helpful.

> How will this kind of thing work in gnupg 2.1?

Actually 2.0 behaves just the same for gpgsm because gpgsm has always
stored the keys under control of the gpg-agent.

Any modern version of gpg2 should connect to a running agent using the
socket "S.gpg-agent" in the home directory if the envvar GPG_AGENT_INFO
is not set (which is the default for 2.1).

The problem is that if there is no running agent, a new agent is started
but --homedir is not passed to that agent.  This is clearly surprising
and should be fixed.  Dirmngr in 2.1 is already started on the fly with
--homedir passed.  Stay tuned for the next commit.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

More information about the Gnupg-devel mailing list