How Do You Remove a GPG from Your trusted.gpg.d Directory?

Problem scenario
You are using a Debian distribution of Linux, and there is a .gpg file in your .../trusted.gpg.d/ directory that you want eliminated. What should you do?

Solution
1. Run this: sudo apt-key list

2. Mentally identify the matching key you want deleted. Here is an example of the output from the above command:

/etc/apt/trusted.gpg.d/cccv-archive-key.gpg
-------------------------------------------
pub   rsa3072 2021-08-14 [SC] [expired: 2022-04-24]
      1234 ABCD 5678 EFGH 9101 IJKL 1112 MNOP 1314 QRST
uid           [ expired] packages.cccv.de <infra@cccv.de>

The alphanumeric string you need is after the "[expired: 2022-04-24] section and before the "uid" string.

3. Run this command with the string obtained in step #2: sudo apt-key del "1234 ABCD 5678 EFGH 9101 IJKL 1112 MNOP 1314 QRST"

Leave a comment

Your email address will not be published. Required fields are marked *