1

I am building a script that is using msmtp to send myself regular system reports by email. I have used gpg to encrypt my email password and used password-eval in msmtp.conf.

I sent a test email successfully but during the process, gpg asked me for the passphrase I used to create keys when I gpg --full-generate-key.

Given that the script will be running unattended, I need to cache the passphrase using gpg-preset-passphrase. However when I run /usr/lib/gnupg2/gpg-preset-passphrase --preset <keygrip> where keygrip is obtained using gpg --list-keys --with-keygrip, I get the error message: gpg-preset-passphrase: caching passphrase failed: Not supported.

For reference, I am using gpg 2.2.12 on a Raspberry Pi 2 Model B running Raspbian Buster.

Kindly assist.

1

This feature must first be enabled in ~/.gnupg/gpg-agent.conf using the option:

allow-preset-passphrase

After editing the config it might be enough to gpg-connect-agent reloadagent /bye, or you might need to restart the agent completely.

Note that the preset passphrase is only stored in memory – it will not persist across reboots. (How would gpg-agent store it securely, anyway?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.