guessing GPG_AGENT_INFO
Nicholas Cole
nicholas.cole at gmail.com
Tue Sep 30 10:29:09 CEST 2008
On Tue, Sep 30, 2008 at 7:44 AM, Werner Koch <wk at gnupg.org> wrote:
> On Mon, 29 Sep 2008 22:17, nicholas.cole at gmail.com said:
>
>> Is there any way to correctly 'guess' the settings for the
>> GPG_AGENT_INFO variable (for the case where gpg-agent has been called
>> with --use-standard-socket)?
>
> That is easy. With --use-standard-socket the socket used is
>
> ~/.gnupg/S.gpg-agent
>
> unless GNUPGHOME is set in which case it is
>
> ${GNUPGHOME}/S.gpg-agent
>
> The environment variable you want is thus
>
> GPG_AGENT_INFO="${GNUPGHOME:-${HOME}/.gnupg}/S.gpg-agent:-1:1"
>
> We do not actually need the PID, thus we set it to -1. The trraling 1
> is the protocol version (not checked, iirc).
>
> If you don't use --use-standard-socket you can try to write a scripts
> based on
>
> netstat -lx | awk '/\/S.gpg-agent$/ { print $8 }'
>
> but you need to figure out whether this is the socket for the desired
> user. Maybe -lxp would be helpful.
Fantastic, Warner. Thank you!
More information about the Gnupg-users
mailing list