gpg on cron task

Olaf Gellert og at
Fri Feb 10 10:28:20 CET 2006

Anders Zachrison wrote:
> * enediel gonzalez <enediel at> [060206 16:57]:
>> #!/bin/bash
>> cd /tmp/backup && /bin/echo apassword | /usr/bin/gpg -se --passphrase-fd 0 
>> --logger-fd 1 -r enediel at /tmp/backup/backup20060206100521 >> 
>> /tmp/debug3.txt

You should be aware that any user on the system who can
run "ps" might see the password while your commands are

>> Executing it from a cron task I obtained in /tmp/debug3.txt the following 
>> line
>> gpg: cannot open `/dev/tty': No such device or address
> As you are going to run gpg from a cron job, ie without any associated
> tty, have you checked `man gpg`? Especially the options '--batch' and
> '--no-tty'?
> You're running gpg as a batch job and from cron, ie no tty available.
> GPG can in some occasions still print warnings to the tty even though
> --batch is used as on option.

And even when "--no-tty" and "--batch" are given on the
commandline, GPG may ask questions, if I remember correctly.
For encrpytion it should work anyway, without questions.


Dipl.Inform. Olaf Gellert                  PRESECURE (R)
Senior Researcher,                       Consulting GmbH
Phone: (+49) 0700 / PRESECURE           og at

                        A daily view on Internet Attacks

More information about the Gnupg-users mailing list