gpg: public key not found - how to tell gpg where to find the public key?


Well-Known Member
Mar 25, 2002
In the 'Manage OpenPGP Keys' section of cPanel for one of my hosting accounts ('accname') I've just successfully imported a openPGP public key for a specific email address (let's call it [email protected]). If I navigate to /home/accname/.gnupg/ I can see some *.gpg files.

OK, now I want to test gpg by encrypting a test text file that I created and stored here


Logging in as root, I navigated here:


and entered the following command:

gpg -e -r [email protected] test.txt

But no luck: the error that came back was:

gpg: [email protected]: skipped: public key not found
gpg: test_message.txt: encryption failed: public key not found

Where am I going wrong? Why can't gpg find the public key for Am I supposed to specify the exact path to the /home/accname/.gnupg folder as an option in the gpg command (and if so, how - I've studied man gpg and can't work it out)?

All I want to do is to encrypt a plain text message on the server using gpg and my imported public key - I'm not bothered about trying to unencrypt.

I believe it's irrelevant, but I found the gpg command in two places on my server:

entering 'which gpg' at the command prompt tells me that /usr/local/bin/gpg is first choice.

Thanks very much for you help.


Mar 6, 2006
Adelaide, Australia
GPG encryption

I am currently trying to encrypt form data using GPG to be sent to an email address. However am limited by the fact that this is being done using our ISP's web server which has cPanel installed (and no SSH access). I created the certificates using cPanel but can't seem to get gpg to encrypt a test text file using a simple php script. ANY help would be appreciated!

Will happily provide the PHP scripts I've been using if anyone wants to see what I've done so far...