List public keys in Debian and check if they are expired or about to expire.

On this occasion, I’m going to show you how to list the public keys in Debian in case one of them is out of date and in your case, how to solve it.

The first step is to open a terminal as root, and list the keys of the repositories that we have in the key-ring with the apt-key list command:

$ apt-key list

An example of what we can find:

/etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg
-------------------------------------------------------------------
pub   4096R/C857C906 2014-11-21 [expire: 2022-19-11]
uid                  Debian Security Archive Automatic Signing Key (8/jessie)

In that example, the key is not expired, see where it says [expires: 2022-19-11].

But if it were, we would do the following:

Where it says: pub 4096R / C857C906, we are left with what follows a / .

In this case it would be C857C906, data that we paste just at the end of the next command and execute.

$ apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys C857C906

This should solve the problem, but to be completely sure, we re-list the keys and check their expiration dates.

$ apt-key list

If everything is fine, we can only update:

$ apt-get update && apt-get upgrade

This is all mates, I hope that at some point it can be useful. And if not, knowledge does not take place.

Leave a comment

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

2 + eight =