gpg: encryption failed: public key not found

123098 aoilean at
Thu Apr 7 13:36:31 CEST 2011

I've made a script that (among other things) encrypts some sensitive data
that I have to send afterwards to a different user on a different computer.
If I encrypt the data by command-line I have no problem at all and
everything goes smoothly. However, when I try to get cron to run the script,
I get the error:

gpg: [Recipient's_ID]: skipped: public key not found
gpg: [Filename]: encryption failed: public key not found

I encrypt the data with the recipient's public key, that is included in my
keyring (I can see it if I list them), and that I signed with my own key.
The syntax that I use is:

gpg --encrypt -r "[Recipient's_ID]" [Filename]

I don't have a clue of what the problem might be, since cron is running as
root and therefore has access to the key's location, and as I said before I
have no problem running the same script manually.

Thanks in advance for your help.
View this message in context:
Sent from the GnuPG - User mailing list archive at

More information about the Gnupg-users mailing list