If you use GnuPG you may choose to cache your password to avoid having to re-enter it each time you need to use your key-pair. The gpg-agent handles this function and a timeout can be set within it’s configuration file typically located within the path ~/.gnupg/gpg-agent.conf

Some distributions such as Fedora 23 don’t include a configuration file. In this case you can create one with the options desired.

Default configuration file defined on an Ubuntu 15.10 system

cat ~/.gnupg/gpg-agent.conf

default-cache-ttl 300
max-cache-ttl 999999

Let’s examine these a little closer

default-cache-ttl n

Set the time a cache entry is valid to n seconds. The default is 600 seconds. Each time a cache entry is accessed, the entry’s timer is reset. To set an entry’s maximum lifetime, use max-cache-ttl.

max-cache-ttl n

Set the maximum time a cache entry is valid to n seconds. After this time a cache entry will be expired even if it has been accessed recently or has been set using gpg-preset-passphrase. The default is 2 hours (7200 seconds).

Enable the new options

To allow the gpg-agent to start using the new options  simply add use-agent to the end of the file ~/.gnupg/gpg.conf

echo use-agent >> ~/.gnupg/gpg.conf

Lastly restart the gpg-agent daemon for the change to take effect. (or restart the system)

killall -q gpg-agent
eval $(gpg-agent --daemon)
source ~/.bashrc


On Ubuntu 15.10 it was required to add the use-agent directive to the end of the ~/.gnupg/gpg.conf file however Fedora 23 did not need this.