Thanks.  This has been resolved by placing the parameter "--homedir
/root/.gnupg" on the gpg command line.

-----Original Message-----
From: Hardeep Singh [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 28, 2008 8:57 AM
To: Adam Robins
Cc: [email protected]
Subject: Re: Problem running automated gpg

Tried to figure this one out, but no direct clue. My suggestions:
create a shell script and call the shell script from perl, rather than
directly calling gpg with all the parameters. Second, try to print the
current user from within perl similarly as printing ~. These two might
give you some clue.

Hardeep Singh
http://blog.Hardeep.name



2008/10/22 Adam Robins <[EMAIL PROTECTED]>:
> Hello,
>
>
>
> I have a perl script called encrypt.pl that runs gpg as follows:
>
>
>
> system("gpg -r 'username' --batch --encrypt-files 'filename.ext'
> 2>gpgerr.log");
>
>
>
> 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/encrypt.pl 2> gpgerr.log
>
>
>
> I get the following error:
>
>
>
> gpg: failed to create temporary file
> `~/.gnupg/.#lk0x9693868.server.domain.com.28416': No such file or
directory
>
> 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.
>
>
>
> Thanks,
>
> Adam
>
>
>
> _____________________________________________________________
> Adam Robins, CCP
> Executive Vice President / Chief Information Officer
>
> PHARMACENTRA, LLC
> 5901B Peachtree Dunwoody Road, Suite 380
> Atlanta, GA 30328
>
>
>
> Office:  770-395-0088 x2034
>
> Mobile: 770-855-1360
> Fax:     770-395-0989
> E-mail:  [EMAIL PROTECTED]
>
> Web:    www.pharmacentra.com
>
> _____________________________________________________________
>
>
>
> _______________________________________________
> Gnupg-users mailing list
> [email protected]
> http://lists.gnupg.org/mailman/listinfo/gnupg-users
>
>

_______________________________________________
Gnupg-users mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to