1APT-KEY(8) APT APT-KEY(8)
2
3
4
6 apt-key - Deprecated APT key management utility
7
9 apt-key [--keyring filename] {add filename | del keyid | export keyid |
10 exportall | list | finger | adv | update | net-update |
11 {-v | --version} | {-h | --help}}
12
14 apt-key is used to manage the list of keys used by apt to authenticate
15 packages. Packages which have been authenticated using these keys will
16 be considered trusted.
17
18 Use of apt-key is deprecated, except for the use of apt-key del in
19 maintainer scripts to remove existing keys from the main keyring. If
20 such usage of apt-key is desired the additional installation of the GNU
21 Privacy Guard suite (packaged in gnupg) is required.
22
23 apt-key(8) will last be available in Debian 12 and Ubuntu 23.10.
24
26 apt-key supports only the binary OpenPGP format (also known as "GPG key
27 public ring") in files with the "gpg" extension, not the keybox
28 database format introduced in newer gpg(1) versions as default for
29 keyring files. Binary keyring files intended to be used with any apt
30 version should therefore always be created with gpg --export.
31
32 Alternatively, if all systems which should be using the created keyring
33 have at least apt version >= 1.4 installed, you can use the ASCII
34 armored format with the "asc" extension instead which can be created
35 with gpg --armor --export.
36
38 add filename (deprecated)
39 Add a new key to the list of trusted keys. The key is read from the
40 filename given with the parameter filename or if the filename is -
41 from standard input.
42
43 It is critical that keys added manually via apt-key are verified to
44 belong to the owner of the repositories they claim to be for
45 otherwise the apt-secure(8) infrastructure is completely
46 undermined.
47
48 Note: Instead of using this command a keyring should be placed
49 directly in the /etc/apt/trusted.gpg.d/ directory with a
50 descriptive name and either "gpg" or "asc" as file extension.
51
52 del keyid (mostly deprecated)
53 Remove a key from the list of trusted keys.
54
55 export keyid (deprecated)
56 Output the key keyid to standard output.
57
58 exportall (deprecated)
59 Output all trusted keys to standard output.
60
61 list, finger (deprecated)
62 List trusted keys with fingerprints.
63
64 adv (deprecated)
65 Pass advanced options to gpg. With adv --recv-key you can e.g.
66 download key from keyservers directly into the trusted set of keys.
67 Note that there are no checks performed, so it is easy to
68 completely undermine the apt-secure(8) infrastructure if used
69 without care.
70
71 update (deprecated)
72 Update the local keyring with the archive keyring and remove from
73 the local keyring the archive keys which are no longer valid. The
74 archive keyring is shipped in the archive-keyring package of your
75 distribution, e.g. the debian-archive-keyring package in Debian.
76
77 Note that a distribution does not need to and in fact should not
78 use this command any longer and instead ship keyring files in the
79 /etc/apt/trusted.gpg.d/ directory directly as this avoids a
80 dependency on gnupg and it is easier to manage keys by simply
81 adding and removing files for maintainers and users alike.
82
83 net-update (deprecated)
84 Perform an update working similarly to the update command above,
85 but get the archive keyring from a URI instead and validate it
86 against a master key. This requires an installed wget(1) and an APT
87 build configured to have a server to fetch from and a master
88 keyring to validate. APT in Debian does not support this command,
89 relying on update instead, but Ubuntu's APT does.
90
92 Note that options need to be defined before the commands described in
93 the previous section.
94
95 --keyring filename (deprecated)
96 With this option it is possible to specify a particular keyring
97 file the command should operate on. The default is that a command
98 is executed on the trusted.gpg file as well as on all parts in the
99 trusted.gpg.d directory, though trusted.gpg is the primary keyring
100 which means that e.g. new keys are added to this one.
101
103 Except for using apt-key del in maintainer scripts, the use of apt-key
104 is deprecated. This section shows how to replace existing use of
105 apt-key.
106
107 If your existing use of apt-key add looks like this:
108
109 wget -qO- https://myrepo.example/myrepo.asc | sudo apt-key add -
110
111 Then you can directly replace this with (though note the recommendation
112 below):
113
114 wget -qO- https://myrepo.example/myrepo.asc | sudo tee
115 /etc/apt/trusted.gpg.d/myrepo.asc
116
117 Make sure to use the "asc" extension for ASCII armored keys and the
118 "gpg" extension for the binary OpenPGP format (also known as "GPG key
119 public ring"). The binary OpenPGP format works for all apt versions,
120 while the ASCII armored format works for apt version >= 1.4.
121
122 Recommended: Instead of placing keys into the /etc/apt/trusted.gpg.d
123 directory, you can place them anywhere on your filesystem by using the
124 Signed-By option in your sources.list and pointing to the filename of
125 the key. See sources.list(5) for details. Since APT 2.4,
126 /etc/apt/keyrings is provided as the recommended location for keys not
127 managed by packages. When using a deb822-style sources.list, and with
128 apt version >= 2.4, the Signed-By option can also be used to include
129 the full ASCII armored keyring directly in the sources.list without an
130 additional file.
131
133 /etc/apt/trusted.gpg
134 Keyring of local trusted keys, new keys will be added here.
135 Configuration Item: Dir::Etc::Trusted.
136
137 /etc/apt/trusted.gpg.d/
138 File fragments for the trusted keys, additional keyrings can be
139 stored here (by other packages or the administrator). Configuration
140 Item Dir::Etc::TrustedParts.
141
142 /etc/apt/keyrings/
143 Place to store additional keyrings to be used with Signed-By.
144
146 apt-get(8), apt-secure(8)
147
149 APT bug page[1]. If you wish to report a bug in APT, please see
150 /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.
151
153 APT was written by the APT team <apt@packages.debian.org>.
154
156 Jason Gunthorpe
157
158 APT team
159
161 1. APT bug page
162 http://bugs.debian.org/src:apt
163
164
165
166APT 2.7.6 28 June 2023 APT-KEY(8)