I encrypted one file with gpg -c <file>
and closed the terminal. After a while, I tried to decrypt it with gpg <file>
and it decrypted it, without asking for a password. Is that normal? How to guarantee that gpg will ask for a password, even in my same computer?
Gpg does not ask for password
gpg
Best Answer
This is normal,
gpg
now usesgpg-agent
to manage private keys, and the agent caches keys for a certain amount of time (up to two hours by default, with a ten minute inactivity timeout).To change the defaults, create or edit a file named
~/.gnupg/gpg-agent.conf
, and use the following entries:default-cache-ttl
specifies the amount of time a cache entry is kept after its last use, in seconds (600 by default);max-cache-ttl
specifies the maximum amount of time a cache entry is kept, in seconds (7200 by default).After changing these, you’ll need to reload the configuration (try sending
SIGHUP
togpg-agent
, or killing it outright).