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-k...@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"
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Gnupg-users mailing list Gnupg-users@gnupg.org http://lists.gnupg.org/mailman/listinfo/gnupg-users