Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Tutorials online say to use the option --keyserver, like this:

gpg --send-keys <keyID> --keyserver 'hkp://keyserver.ubuntu.com:11371'

but gpg doesn't recognise the option --keyserver. What am I doing wrong?

share|improve this question
1  
I can't see a difference between these two. BTW gpg (GnuPG) 1.4.12 supports and it's man page is not silent about --keyserver –  Serge Sep 30 '12 at 0:30
    
@Serge the commands has an argument <keyID> that isn't visible because was interpreted as an HTML tag. I suggested an edit to correct this. –  Kanvuanza Sep 30 '12 at 0:41
1  
@Korgan, You asked a question along with the answer. You may want create a new answer and mark as solved. It's OK. –  Kanvuanza Sep 30 '12 at 0:48
    
The right thing will be: gpg --keyserver 'hkp://keyserver.ubuntu.com:11371' --send-keys <keyid>* - I would not intermix switches and values –  Serge Sep 30 '12 at 1:02
    
@Kanvuanza aha, I see now) –  Serge Sep 30 '12 at 1:35
show 1 more comment

1 Answer

GPG's command-line parsing is a bit odd:

gpg [--homedir dir] [--options file] [options] command [args]

The correct order is options, then the command, then the command's arguments, so you should do:

gpg --keyserver 'hkp://keyserver.ubuntu.com:11371' --send-keys <keyID>

It looks like GPG will let you get away with putting the command before the options, so you can also do:

gpg --send-keys --keyserver 'hkp://keyserver.ubuntu.com:11371' <keyID>

But the command's arguments (in this case, <keyID>) must be last. From the man page:

Please remember that option as well as command parsing stops as soon as a non-option is encountered,

share|improve this answer
add comment

Your Answer

 
discard

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.