decryption failed: secret key not available
kloecker at kde.org
Sat Nov 9 18:29:03 CET 2019
On Samstag, 9. November 2019 01:42:47 CET Bobby Richardson (bobbyric) wrote:
> I need a help in my gpg decryption with crontab.
> Recently my gpg decryption with crontab started failing.
What did you change recently?
> If I do gpg decryption without crontab, it works fine.
cron provides a minimal environment to the jobs it runs. Maybe some
environment variables are missing if your script is run by cron.
> Here is my background information:
> Platform: Centos 7
> gpg version: 2.0.22
> # When I use crontab with my decryption script in perl, I get following
> result: PGP Decryption Begins.
> Found: [JW11072019_8559.OUT.pgp] to decrypt.
> gpg: encrypted with ELG key, ID 636A4204
> gpg: decryption failed: No secret key
> # In my login credential profile, I have following configuration:
> chmod 666 `tty`
> # GPG Decrytion
> in my perl script.
> # $PGPpwd has a passphrase string.
> `echo $PGPpwd | gpg2 --batch --passphrase-fd 0 --decrypt $PGPFile >
I suggest removing the passphrase from your secret key. Securing your secret
key with a passphrase and then putting this passphrase in cleartext into a
script makes batch decryption much more complicated without providing any
If that does help increase the verbosity of gpg and enable debug logging.
More information about the Gnupg-users