1828663 Members
1504 Online
109984 Solutions
New Discussion

GnuPG automation

 
Gary Hines
Advisor

GnuPG automation

Hi,
I'm having trouble getting a decryption script working using GnuPG. I've tried both expect and python (GnuPGInterface). The Expect script seems to just hang, and the Python script works fine from the command-line, but when I put it into cron, it generates a stack trace error list. Does anybody have a script that does decryption and that can be used from cron without any problems. Thanks for any help and/or pointers.

Gary
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor

Re: GnuPG automation

Hi Gary:


The basic comment I can make is that 'cron' provides a very minimal environment. If the script works correctly from a shell but not under 'cron', a good place to start looking is at environmental variables that you "always" have in your normal shell environment, because they were set in your login profile. For example, 'cron' provides a PATH defined only as '/usr/bin:/usr/sbin'.

Regards!

...JRF...
Gary Hines
Advisor

Re: GnuPG automation

Hi James,
I didn't even think of that. Now that I modified the path, it seems to make a difference, but I'm getting a different error which seems strange. I'm wondering if someone here could shed some light on it. The error is:

gpg: cannot open '/dev/tty': No such device or address

It seems totally bizarre that it can't open a tty.

Gary
Peter Nikitka
Honored Contributor

Re: GnuPG automation

No,

its normal in cron not having a tty:
cron is a daemon, not sitting in front of a terminal.
Think of the classical 'who' command - ever tried to call it in cron?

Look for options that fulfill ALL information GnuPG requests; perhaps you can supply some information via a pipe:
echo 'input
input' | GnuPG

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Gary Hines
Advisor

Re: GnuPG automation

Still don't have it working. It seems GPG just doesn't want to work without a TTY. I guess I'm going to have to break down, and write a script to control it from a windows telnet session. Thanks for the pointers though.