Scripting GPG without retaining keys

Jon Spriggs jon at
Tue Apr 5 16:59:24 CEST 2016

Hi all,

I'm trying to write a script which encrypts against keys retrieved
from a keyserver but doesn't cache them.

I've got the following:

gpg --no-options --trust-model always --no-default-keyring --keyserver
ldap:// --keyserver-options auto-key-retrieve
--recipient user at --encrypt a_file.txt

I keep getting "gpg: user at skipped: No public key"

However, if I replace --recipient and --encrypt with --search-keys
user at I get the key back.

Is this a failure in my understanding of the gpg command line, or have
I missed some fundamental part of the documentation somewhere?

Thanks in advance!
Jon "The Nice Guy" Spriggs

More information about the Gnupg-users mailing list