如何去除rpm的公钥

一不小心导入了同名称但是不同内容的公钥,然后在再次导入正确的公钥的时候,发现已经导入不了,提示内容如下:
[cnangel@localhost cnangel]$sudo rpm --import RPM-GPG-KEY-cnangel
error: RPM-GPG-KEY-cnangel: import failed.
而查看rpm的选项没有delete相关操作;重新import并使用--force选项,则提示:
rpm: only installation, upgrading, rmsource and rmspec may be forced
查看路径/etc/pki/rpm-gpg/下面也没有刚才错误的导入公钥文件,该如何删除错误的公钥而导入正确的公钥呢?
经过查看rpm和gpg相关文档,可以用如下方案解决:
[cnangel@localhost ~]$rpm -q gpg-pubkey
gpg-pubkey-57bbccba-4a6f97af
gpg-pubkey-16ca1a56-4a100959
gpg-pubkey-a3a882c1-4a1009ef
原来,经过查询获得gpg-pubkey的公钥就是这些结果,不过无法显示是哪个文件导入的,不过还是有版本,这个查询接口的排序是时间先后顺序,所以可以推算刚才导入错误的文件是第几个,然后删除即可:
[cnangel@localhost ~]$sudo rpm -e --allmatches gpg-pubkey-16ca1a56-4a100959
接着,可以导入正确的公钥了 :)

Monthly Archives

Pages

Powered by Movable Type 7.7.2

About this Entry

This page contains a single entry by Cnangel published on June 4, 2010 10:09 PM.

fedora13的发布 was the previous entry in this blog.

一种特殊的一致性哈希算法的研究 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.