--homedir in gnupg 2.1

Nicholas Cole nicholas.cole at gmail.com
Wed Apr 23 10:12:39 CEST 2014


On Tue, Apr 22, 2014 at 1:10 PM, Werner Koch <wk at gnupg.org> wrote:
> 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.

Thanks Werner.

I assume that works because gpg-agent sets appropriate environment
variables, and that I could set it up so that it doesn't interfere
with any other gpg-agent processes that might be running.

So just to be clear, I would need to:

start a new agent with a non-standard --homedir
make sure that GPG_AGENT_INFO is set
start gpg with the non-standard --homedir


Best wishes,

N.



More information about the Gnupg-devel mailing list