When I was following this tutorial to setup GnuPG for mutt account profiles on my personal laptop, I hit gpg-agent is not available in this session
error when I was trying to decrypt my profile. Also, I have to type my password for every time when I try decryption.
This is annoying.
With a little poking around, I found 2 reasons that could affect my setup. First, the gpg-agent.conf under ~/.gnupg. My current setup is:
default-cache-ttl 999999 max-cache-ttl 999999 ignore-cache-for-signing
Obviously I maxed-out the expiration time gpg-agent stores my password in cache (the default-cache-ttl value. It used to be 0).
Secondly, I installed gnupg2 long time ago and I was using gpg-agent for GnuPG 2, the gpg command is actually from GnuPG 1. This confused me a little to figure out. Make sure to use gpg2
command rather than gpg
.
If you are encrypting mutt profile too, make sure to use gpg2
everywhere.
Finally, run this at boot time to start an agent daemon.
gpg-agent --daemon --allow-preset-passphrase