scripting gpg

Jon Drukman jsd at
Thu May 5 01:01:44 CEST 2011

I need to do the following:

- when a new machine is created, automatically import a public key and give it
full trust

- be able to encrypt files with that public key without any interactive
prompting (from a shell script/cron job)

in other words, a machine has to go from virgin state (OS + software only) to
being able to encrypt and transmit encrypted files without any prompting or
other user interaction.

I know about the 'trust' command but I don't see any non-interactive way to
achieve that.  Alternatively, if the gpg binary would stop giving me the "It is
NOT certain that the key belongs to the person named
in the user ID.  If you *really* know what you are doing,
you may answer the next question with yes." prompt that would be fine too.

Are there some hidden command line options/environment variables I am missing?

More information about the Gnupg-users mailing list