Restarting gnupg-agent inside X session

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Mar 1 02:20:46 CET 2011


On 02/28/2011 06:49 PM, David Tomaschik wrote:
> Each process has its own copy of the environment inherited from its
> parent, so it's not possible to change the GPG_AGENT_INFO variable for
> all processes.  You could start gpg-agent with --use-standard-socket,
> and programs should fall back to that.

Alternately, since you probably already know the current setting of
GPG_AGENT_INFO, you could just start the agent and link its new socket
to the place where the old one used to be.  Something like (untested):

 old_socket=$(printf "%s" "$GPG_AGENT_INFO" | sed 's/:.*$//')
 mkdir -m 0700 -p $(dirname "$old_socket")
 eval $(gpg-agent --daemon)
 new_socket=$(printf "$s" "$GPG_AGENT_INFO" | sed 's/:.*$//')
 ln "$new_socket" "$old_socket"


hth,

	--dkg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1030 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20110228/17dd50e8/attachment.pgp>


More information about the Gnupg-users mailing list