For documentation purposes, about the apt-key
command in many places I found these two variations:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys PUBKEY
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv PUBKEY
Observe the difference about the latest option --recv-keys
and --recv
. About the Ubuntu's official man
at jammy apt-key(8) does mention only about:
adv (deprecated)
Pass advanced options to gpg. With adv **--recv-key** you can e.g. download key from
keyservers directly into the trusted set of keys. Note that there are no checks
performed, so it is easy to completely undermine the apt-secure(8) infrastructure if
used without care.
And now from above see other option --recv-key
(different as --recv-keys
- it ends with s)
And at jammy gpg(1) does mention only about:
--recv-keys keyIDs
Import the keys with the given keyIDs from a keyserver.
Observation in the mentioned man
appears the --recv-key
term as content for other options but it does not exist as an option definition itself. ( consider to use the ctrl + f keys to search using the --recv
as search term, it because there is a line with the --recv-key
term split in 2 lines.)
Question
- What is the difference among
--recv-key
,--recv-keys
and--recv
options?
If exists these 3 options, therefore each one has a specific purpose.
It's not obvious from the documentation, but gpg is one of those commands where you can pass a unique prefix of an option instead of having to type it out in full. If you had two options such as:
Then any of
--some-l
,--some-lo
,--some-lon
, etc. is enough to distinguish it from--some-other-long-option
. So, you could use these abbreviated forms instead of always using--some-long-option
.This is implied by the documentation however, where it says that "the option may not be abbreviated" in
gpg.conf
(and some other options like--help
,--version
, etc. cannot be abbreviated either).So all three of
--recv
,--recv-key
and--recv-keys
are equivalent.