How to let Makefile uses gpg passwordlessly?
I have a Makefile that calls gpg to decrypt text files before opening it with a text editor for editting. Because I do it frequently, I'd like save time typing in password every time, how can I set up 开发者_Go百科gpg to remember I passed the password test recently? For example, trigger me to type in password only if I haven't done it in the last 30 minutes.
Thanks!
I think there are two ways to do this:
let
gpg
read the passphrase from a file using the option--passphrase-file
(but the gpg man page advises against using this option if you can avoid it! And i think you can avoid it as follows...);use
gpg-agent
for caching the passphrase. If the shell script requires you to enter the passphrase every time, there's likely no agent running. If a gpg-agent is running,env | grep GPG
should give some output likeGPG_AGENT_INFO=/tmp/gpg-6YivG1/S.gpg-agent:10479:1
. If there's no GPG_AGENT_INFO variable set, you may have to start gpg-agent manually or (preferable) configure your system to start the gpg-agent automatically. How to do this depends on your distribution. The GnuPG Manual has some infos about this.
精彩评论