Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do you exchange keys with via key server?

Worked example would be great with send and find+retrieve.

I know gpg --send-keys is the command but how do you find the keyid (tried all output from ---list-keys). --keyserver works with --send-keys but not with --search-keys (says bad uri). Which keys should I publish? What key server to publish to. Despite being a pretty simple program, the gnugp docs are terrible (broken links, missing info).

share|improve this question
up vote 7 down vote accepted

What Went Wrong

You're dealing with two problems:

  1. gpg --search-keys searches keyservers, not locally. Use gpg --list-keys instead.
  2. GnuPGs keyserver domain is, not (typo). Additionally, you have to prefix a protocol, hkp:// is supported by most keyservers.

Relevant Commands for Exchanging Keys

  • gpg --send-keys [keyid]: Send key id to a keyserver
  • gpg --recv-keys [keyid]: Fetch key id from a keyserver
  • gpg --search-keys [needle]: Search for keys on a keyserver that contain "needle", eg. in a UID
  • gpg --list-keys [needle]: List all local keys that contain "needle", eg. in a UID

To select another keyserver than the default one configured, use --keyserver [URI]. Make sure to use a complete and valid URI like hkp://, or hkp:// (which actually refers to the SKS keyserver pool ourdays).

share|improve this answer
Should I publish my pub, sub or both keys? – Brian Low Sep 13 '13 at 5:00
Publish all public keys. You want to use your subkeys for "daily work", so they need to be published. Signatures are bound to the primary key, so for validating that one is necessary, too. But you do not have to care about all that, GnuPG does for you, just use gpg --send-keys [primary] and it will also upload your (public) subkeys. – Jens Erat Sep 13 '13 at 7:58

Just for completion: it doesn't matter which key server you use. They do synchronise their keys.

I use which is a virtual load balancing key server.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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