1

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 <encrypt@email.com>"
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 <encrypt@email.com>"
gpg: public key decryption failed: General error
gpg: decryption failed: No secret key
[www@localhost data]$ gpg --list-keys
/home/www/.gnupg/pubring.gpg
----------------------------
pub   2048R/B943D3E2 2015-06-24
uid                  Encrypt <encrypt@email.com>
uid                  Master <master@email.com>
sub   2048R/8E7BFE3A 2015-06-24
sub   2048R/6E704692 2015-06-24

[www@localhost data]$ gpg --list-secret-keys
/home/www/.gnupg/secring.gpg
----------------------------
sec   2048R/B943D3E2 2015-06-24
uid                  Master <master@email.com>
uid                  Encrypt <encrypt@email.com>
ssb   2048R/8E7BFE3A 2015-06-24
ssb   2048R/6E704692 2015-06-24
  • Have you imported the secret and PUBLIC key? – Ruban Savvy Jul 7 '15 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. – Gilles Jul 7 '15 at 22:58
  • What's the version of gpg (gpg --version)? What is the output of echo $GPG_AGENT_INFO? – Gilles Jul 7 '15 at 23:00
2

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.