Encrypting a password using gpg without constantly asking for password

gpgpasswordSecurity

I have a service that checks my email regularly, and I use gpg to encrypt my email password. The problem is that every time I lock my computer or after a certain amount of time gpg shows a graphical interface to ask for the password.

Is there a way, even if it's less secure, to have gpg remember my password until I restart my computer? Or perhaps use my log-in password which I have to input anyways to unlock my computer? If that's not possible with gpg, is there another tool that can achieve this?

Best Answer

GPG can not directly be set to keep the password until restart, but you can change the time it caches the passwords to a very long time, e.g. a year. Add the following lines to $GNUPGHOME/gpg-agent.conf ($GNUPGHOME is usually ~/.config/gnupg):

default-cache-ttl 31536000
max-cache-ttl 31536000

This sets the time for caching passphrases to one year (31536000 seconds). default-cache-ttl is the normal caching time, which is reset when the key is used (so on each use it is cached longer), while max-cache-ttl limits the total time including extensions.

Related Question