Restarting gnupg-agent inside X session

Marco Steinacher marco+gnupg at websource.ch
Tue Mar 1 11:15:58 CET 2011


Daniel Kahn Gillmor wrote:
> 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"

David and Daniel, many thanks for your suggestions! I was not aware of
the --use-standard-socket option. I think this will do it for me.
Linking the new socket to the old one is also a nice way I didn't think
of and maybe it will be useful someday.

Marco
-- 
OpenPGP Key ID: 0x62937F7F

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


More information about the Gnupg-users mailing list