DelphiFAQ Home Search:

InterBase, MS-SQL, mysql, Oracle
C#, C++, Delphi, Java,
JavaScript, perl, php, Visual Basic, VBScript
Apache, Network, Shell
Web Publishing
JavaScript, perl CGI, VBScript, Web Hosting
Apache, File Types, Internet Explorer,
Network, Printing, Processes
Outside the Cube
Auto, Computer Hardware,
Finances, Dating Scams,
Household, Male Dating Scammers,
Other Scams, Travel

Featured Article

Error message "GnuPG has not been setup on your account"


I call gpg from a CGI script and it does report:

"GnuPG has not been setup on your account. Use the form below to create a new GnuPG private key, which you will need for encryption and signing."

In fact, I created several keys already from the command line. If I type
gpg --list-keys

it will show me these keys. Issuing the same command from the CGI script returns no output. My web server runs as root, I run webmin's miniserver.


Try issuing gpg --help from your CGI code. I did this and it reported ~/.gnupg to be the home directory.
This is valid from the command line where the ~ gets expanded properly but does not work in the CGI environment.
To enumerate keys in your CGI code, add the parameter to explicitely set the home directory, without using the ~ character, as shown below.

The code shown here will force gpg to use one central repository, independent from the current login/ current remote user name.

$cmd = "$gpgpath  --homedir /home/myname/.gnupg/ --list-keys";
 $answer = `$cmd`;

Generated 8:02:09 on Sep 27, 2020