APT-KEY(8)
๐ NAME
apt-key โ the deprecated APT key management utility โจ
๐ SYNOPSIS
apt-key [--keyring filename] {add filename | del keyid | export keyid |
exportall | list | finger | adv | update | net-update |
{-v | --version} | {-h | --help}}
๐ฆ DESCRIPTION
okay bestie, so apt-key is the tool that manages the list of keys apt uses to authenticate packages. Any package that's been authenticated using these keys? considered trusted. periodt. ๐
But. Using apt-key is deprecated โ with exactly one exception: using apt-key del in maintainer scripts to remove existing keys from the main keyring. And if you do wanna use it that way, you also need to install the whole GNU Privacy Guard suite (it's packaged in gnupg). no skips. ๐
Also, heads up: apt-key(8) will last be available in Debian 12 and Ubuntu 24.04. After that it's giving ghosted. ๐
๐ SUPPORTED KEYRING FILES
apt-key is picky โ it only supports the binary OpenPGP format (also known as the "GPG key public ring") in files with the gpg extension. It does not support the keybox database format that newer gpg(1) versions introduced as the default for keyring files.
So if you want a binary keyring file that works with any apt version? Always create it with gpg --export. no cap.
Alternatively, if every system that's gonna use the keyring has at least apt version >= 1.4 installed, you can use the ASCII armored format with the asc extension instead โ created with gpg --armor --export. ๐
๐ COMMANDS
add filename (deprecated)
Adds a new key to the list of trusted keys. The key gets read from the filename you give it โ or, if the filename is -, from standard input.
It is critical that keys added manually viaapt-keyare verified to belong to the owner of the repositories they claim to be for. Otherwise theapt-secure(8)infrastructure is completely undermined. like, entirely. ๐ญ
Note: instead of using this command, a keyring should be placed directly in the /etc/apt/trusted.gpg.d/ directory with a descriptive name and either gpg or asc as the file extension. that's the move. โจ
del keyid (mostly deprecated)
Removes a key from the list of trusted keys.
export keyid (deprecated)
Outputs the key keyid to standard output.
exportall (deprecated)
Outputs all trusted keys to standard output.
list, finger (deprecated)
Lists trusted keys with fingerprints.
adv (deprecated)
Passes advanced options straight to gpg. With adv --recv-key you can, for example, download a 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. please be careful babe.
update (deprecated)
Updates the local keyring with the archive keyring, and removes from the local keyring the archive keys which are no longer valid. The archive keyring is shipped in the archive-keyring package of your distribution โ e.g. the debian-archive-keyring package in Debian.
Note that a distribution does not need to โ and in fact should not โ use this command any longer. Instead it should ship keyring files in the /etc/apt/trusted.gpg.d/ directory directly, because that avoids a dependency on gnupg and it's easier to manage keys by simply adding and removing files, for maintainers and users alike. iconic behavior honestly. ๐ธ
net-update (deprecated)
Performs an update working similarly to the update command above, but it gets the archive keyring from a URI instead, and validates it against a master key. This requires an installed wget(1) and an APT build configured to have a server to fetch from and a master keyring to validate. APT in Debian does not support this command โ it relies on update instead โ but Ubuntu's APT does. iykyk ๐
โจ OPTIONS โจ
Note that options need to be defined before the commands described in the previous section. order matters bestie!!
--keyringfilename (deprecated) โ With this option it's possible to specify a particular keyring file the command should operate on. The default is that a command is executed on thetrusted.gpgfile as well as on all parts in thetrusted.gpg.ddirectory โ thoughtrusted.gpgis the primary keyring, which means that e.g. new keys are added to this one. ๐
๐ง DEPRECATION
Except for using apt-key del in maintainer scripts, the use of apt-key is deprecated. This section shows how to replace existing use of apt-key. ๐
If your existing use of apt-key add looks like this:
wget -qO- https://myrepo.example/myrepo.asc | sudo apt-key add -
Then you can directly replace this with (though note the recommendation below):
wget -qO- https://myrepo.example/myrepo.asc | sudo tee /etc/apt/trusted.gpg.d/myrepo.asc
Make sure to use the asc extension for ASCII armored keys and the gpg extension for the binary OpenPGP format (also known as "GPG key public ring"). The binary OpenPGP format works for all apt versions, while the ASCII armored format works for apt version >= 1.4. ๐ฆ
Recommended: instead of placing keys into the /etc/apt/trusted.gpg.d directory, you can place them anywhere on your filesystem by using the Signed-By option in your sources.list and pointing to the filename of the key. See sources.list(5) for details. Since APT 2.4, /etc/apt/keyrings is provided as the recommended location for keys not managed by packages. And when using a deb822-style sources.list, with apt version >= 2.4, the Signed-By option can also be used to include the full ASCII armored keyring directly in the sources.list without an additional file. main character energy fr fr. ๐
๐ธ FILES
/etc/apt/trusted.gpgโ Keyring of local trusted keys, new keys will be added here. Configuration Item:Dir::Etc::Trusted./etc/apt/trusted.gpg.d/โ File fragments for the trusted keys, additional keyrings can be stored here (by other packages or the administrator). Configuration ItemDir::Etc::TrustedParts./etc/apt/keyrings/โ Place to store additional keyrings to be used withSigned-By.
๐ SEE ALSO
๐ BUGS
APT bug page[1]. If you wish to report a bug in APT, please see /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command. ๐ซถ
โญ AUTHOR
APT was written by the APT team <apt@packages.debian.org>.
๐ AUTHORS
- Jason Gunthorpe
- APT team
๐ NOTES
- APT bug page
https://bugs.debian.org/src:apt
and that's the whole page bestie!! this one shipped as part of APT 2.9.8, dated 20 February 2024 โ so yeah, it's the apt-key(8) manual, section 8, and you now know it front to back. slay. ๐
โจ๐
๐ฆ where this page comes from
- fedora 43: apt 2.9.8-1.fc42 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms