Problem running automated gpg

Adam Robins arobins at
Wed Oct 22 17:35:24 CEST 2008



I have a perl script called that runs gpg as follows:


system("gpg -r 'username' --batch --encrypt-files 'filename.ext'


When I run this from the console as root it works fine.  However, if I
run it from cron as root:


*/1 * * * * root  /home/user/scripts/ 2> gpgerr.log


I get the following error:


gpg: failed to create temporary file
`~/.gnupg/': No such file or

gpg: fatal: ~/.gnupg: can't create directory: No such file or directory

secmem usage: 0/0 bytes in 0/0 blocks of pool 0/32768


The directory "/root/.gnupg" is there.  Permissions are drwx------ root
root.  I also tried chmod 777.


If I put a command in the perl script:


System('echo ~');


I get "/root" as a result.  This leads me to believe that gpg is trying
to place the temp file in a directory other than "/root/.gnupg" when run
from cron.


Any ideas are appreciated.





Adam Robins, CCP
Executive Vice President / Chief Information Officer

5901B Peachtree Dunwoody Road, Suite 380
Atlanta, GA 30328


Office:  770-395-0088 x2034

Mobile: 770-855-1360
Fax:     770-395-0989
E-mail:  arobins at <mailto:arobins at> 

Web: <> 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20081022/10a9d313/attachment.htm>

More information about the Gnupg-users mailing list