gpg: encryption failed: public key not found
John Clizbe
John at enigmail.net
Thu Apr 7 21:40:24 CEST 2011
123098 wrote:
>
> 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.
Umm, no. Even though cron is running as root and has access to your keyring
files, that's not the default location gpg running as root is going to look for
keys. gpg running as root will look for keyring files in /root/.gnupg, or
whatever is root's $HOME. Your command-line encryption looks in your .gnupg
directory for the keyring files, ("~/.gnupg" if --homedir or $GNUPGHOME is not
used).
1) Run gpg as root and import the needed public key(s);
or
2) run the cron job as yourself;
or
3) add --home-dir <directory> to the gpg command;
or
4) set GNUPGHOME to the keys'location before running gpg.
--
John P. Clizbe Inet: John (a) Enigmail DAWT net
FSF Assoc #995 / FSFE Fellow #1797 hkp://keyserver.gingerbear.net or
mailto:pgp-public-keys at gingerbear.net?subject=HELP
Q:"Just how do the residents of Haiku, Hawai'i hold conversations?"
A:"An odd melody / island voices on the winds / surplus of vowels"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 886 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20110407/d9ffe4e3/attachment-0001.pgp>
More information about the Gnupg-users
mailing list