I have copied my GPG keys from 1 server to another, on the first server everything is working correctly, on the new I get the following: (I have included the output of list-keys and list-secret-keys

[www@localhost data]$ gpg escs_hr_feed.pgp

You need a passphrase to unlock the secret key for
user: "Encrypt <[email protected]>"
2048-bit RSA key, ID 8E7BFE3A, created 2015-06-24 (main key ID B943D3E2)

gpg: cancelled by user
gpg: encrypted with 2048-bit RSA key, ID 8E7BFE3A, created 2015-06-24
      "Encrypt <[email protected]>"
gpg: public key decryption failed: General error
gpg: decryption failed: No secret key
[www@localhost data]$ gpg --list-keys
pub   2048R/B943D3E2 2015-06-24
uid                  Encrypt <[email protected]>
uid                  Master <[email protected]>
sub   2048R/8E7BFE3A 2015-06-24
sub   2048R/6E704692 2015-06-24

[www@localhost data]$ gpg --list-secret-keys
sec   2048R/B943D3E2 2015-06-24
uid                  Master <[email protected]>
uid                  Encrypt <[email protected]>
ssb   2048R/8E7BFE3A 2015-06-24
ssb   2048R/6E704692 2015-06-24
  • Have you imported the secret and PUBLIC key? Jul 7, 2015 at 9:50
  • What happened between the “You need a passphrase …” prompt and “gpg: cancelled by user”? If nothing happened, that would be because gpg is trying to contact some keyring, failing, and failing to report the error. Jul 7, 2015 at 22:58
  • What's the version of gpg (gpg --version)? What is the output of echo $GPG_AGENT_INFO? Jul 7, 2015 at 23:00

1 Answer 1


So the problem turned out to be that if you sudo su - to the user, you cannot use gpg, you need to log directly in as the user.

(At least on my companies server setup)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .