[arch-general] Help with gnupg saving password for given time

Randy gumper1034 at gmail.com
Sat Jun 23 00:02:13 EDT 2012

On 06/22/2012 04:22 PM, Kevin Chadwick wrote:
>> I get nothing with this command.
> Your programs will likely ignore the agent and use gpg directly
> using the password once without an environment variable.
> You should have the GPG_AGENT_INFO environment variable already setup as
> the third box in this link does. You can fix it quite easily but why
> it's not there already I'm not sure and is the real issue.
> http://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html
> I presume you switched to openbox from something else which set this
> up automatically.
> --
> ________________________________________________________
>   Why not do something good every day and install BOINC.
> ________________________________________________________

Ok, everything is working as it should now. I originally had the 
following in my Openbox autostart file:

if test -f ${envfile} && kill -0 $(cut -d: -f 2 ${envfile} | head -n 1) 
2>/dev/null; then
    eval $(cat ${envfile})
   eval `/usr/bin/gpg-agent --daemon --enable-ssh-support 
--write-env-file ${envfile}`

/Apparently this isn't the correct way to do it? It would create the 
.gpginfo file ok, but I'm assuming that the export command wasn't 
working correctly. Any ideas why?

I looked at the link that you gave but I wasn't sure where to place the 
command to start the gpg-agent. I figured if I placed it in my Openbox 
autostart file, then there was the possibility of starting the agent 
more than once if logging out and back in. I tried putting it in 
.xsession but it didn't start from there because I use Slim and I 
believe that Slim doesn't call xsession. Maybe putting it in .xinitrc 
would work.

What I ended up doing was per the Arch wiki. Creating the file 
/etc/profile.d/gpg-agent.sh with the following:


if test -f "$envfile" && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut 
-d: -f 2) 2>/dev/null; then
     eval "$(cat "$envfile")"
     eval "$(gpg-agent --daemon --write-env-file "$envfile")"
export GPG_AGENT_INFO  # the env file does not contain the export statement/

This did the trick for me.

Oh and you are correct, I switched from XFCE to Openbox.

Thanks for the help!




More information about the arch-general mailing list