如何删除我添加的 apt-key?

如何删除我添加的 apt-key?

我添加了这样的键:

wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'

现在我想删除这个键。我该怎么做?我不知道它被添加到哪里,它是什么样子的。

当我sudo apt-key list这样做时,控制台上会打印出一些内容。不确定哪一个与我上面所做的相关?

david@machine:~$ sudo apt-key list
/etc/apt/trusted.gpg
--------------------
pub   1024D/437D05B5 2004-09-12
uid                  Ubuntu Archive Automatic Signing Key <[email protected]>
sub   2048g/79164387 2004-09-12

pub   1024D/FBB75451 2004-12-30
uid                  Ubuntu CD Image Automatic Signing Key <[email protected]>

pub   4096R/C0B21F32 2012-05-11
uid                  Ubuntu Archive Automatic Signing Key (2012) <[email protected]>

pub   4096R/EFE21092 2012-05-11
uid                  Ubuntu CD Image Automatic Signing Key (2012) <[email protected]>

pub   1024D/D50582E6 2009-02-01
uid                  Kohsuke Kawaguchi <[email protected]>
uid                  Kohsuke Kawaguchi <[email protected]>
uid                  [jpeg image of size 3704]
sub   2048g/10AF40FE 2009-02-01

/etc/apt/trusted.gpg.d//pubring.gpg
-----------------------------------
pub   2048R/06634014 2013-01-26
uid                  OSP Team <[email protected]>
sub   2048R/732F28E7 2013-01-26

答案1

apt-key add/etc/apt/trusted.gpg默认添加一个键。

这些密钥来自 Ubuntu 存储库:

pub   1024D/437D05B5 2004-09-12
uid                  Ubuntu Archive Automatic Signing Key <[email protected]>
sub   2048g/79164387 2004-09-12

pub   1024D/FBB75451 2004-12-30
uid                  Ubuntu CD Image Automatic Signing Key <[email protected]>

pub   4096R/C0B21F32 2012-05-11
uid                  Ubuntu Archive Automatic Signing Key (2012) <[email protected]>

pub   4096R/EFE21092 2012-05-11
uid                  Ubuntu CD Image Automatic Signing Key (2012) <[email protected]>

然后你就只剩下:

pub   1024D/D50582E6 2009-02-01
uid                  Kohsuke Kawaguchi <[email protected]>
uid                  Kohsuke Kawaguchi <[email protected]>
uid                  [jpeg image of size 3704]
sub   2048g/10AF40FE 2009-02-01

通过运行以下命令将其删除:

sudo apt-key del D50582E6

如果您确实想确保删除了正确的密钥,则可以将密钥再次添加到新的密钥环中:

wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key --keyring /tmp/test add -

然后列出其内容:

sudo apt-key --keyring /tmp/test list

然后您将看到要删除的密钥。

答案2

您也可以直接使用以下命令删除密钥

$ sudo apt-key list | grep 'teejee'

你会得到

/etc/apt/trusted.gpg.d/teejee2008-ppa.gpg

然后,

$ sudo rm /etc/apt/trusted.gpg.d/teejee2008-ppa.gpg

只需再次测试$ sudo apt-key list | grep 'teejee'

答案3

打开软件中心,进入“编辑”→“软件源...”→“其他软件”,你会看到一个“删除”按钮。

相关内容