Quick guide to apt-key

Share your how-tos and guides with other users

Moderators: ChrisThornett, LXF moderators

Quick guide to apt-key

Postby Dutch_Master » Sun Nov 04, 2012 2:59 am

Apt-key is the tool Debian and its derivatives use to manage public keys for its package management tools. This is a quick guide to get you started:

Open a root terminal, or use sudo if your distro is configured to use it, and enter:
Code: Select all
apt-key list
This will list all known keys on your system. A sample to show the general layout:
Code: Select all
pub   4096R/B98321F9 2010-08-07 [expires: 2017-08-05]
uid                  Squeeze Stable Release Key <debian-release@lists.debian.org>

In it, 4096R indicates key length and encryption of the key (RSA in this case), the number B98321F9 is the ID of the key as it's know to your system, the date indicates when it was created (and expire date speaks for itself, I'd assume ;)) followed by the name of the key.

Let's assume you have a key, some_key.asc that you'd want to use. Download it to your user's home directory:
Code: Select all
wget http://www.some.domain.org/some_key.asc
Next, you need to import it:
Code: Select all
apt-key add some_key.asc
To see if the key is imported correctly, update the package list:
Code: Select all
apt-get update
If the key was faulty, incomplete or otherwise unusable, apt will report so.

At some point, a specific key needs to be revoked and removed. This can be done with:
Code: Select all
apt-key del <key-UID>
apt-key list
Listing the keys again allows you to check if the key has been removed from your system. You'd need to update the package list again (see above) to let it forget the revoked key permanently.

Apt-key has a number of other options, use the man-page to study those if you require more then the basics explained above:
Code: Select all
man apt-key

:idea:
Dutch_Master
LXF regular
 
Posts: 2451
Joined: Tue Mar 27, 2007 1:49 am

Apt-get

Postby northumbrian1 » Mon Dec 17, 2012 11:49 am

Very good! I have many of these type of commands, many of whom came via Fosswire or from Linux Format itself in the form of its (now Out-of-print) "A Beginner's Guide To Linux." which I dutifully printed out and sheathed in plastic pages to refer back to when I needed them. Although Ubuntu has changed via its new Desktop (Unity), the basic construct, beneath the surface still exists, that is, its Debian/Ubuntu derivation. I also have quite a few books relating to the administration of Red-Hat type Linux as I have a Laptop with Fuduntu on it which is originally derived from Fedora - which I like, too! Northumrian1
northumbrian1
 
Posts: 17
Joined: Mon Sep 03, 2012 12:19 am
Location: northumberland

Dutch Master?

Postby northumbrian1 » Thu Nov 07, 2013 9:05 pm

I eventually visited Ostend and Bruges three weeks ago and had a short visit to Sluice which was in the Netherlands. I enjoyed my visit despite the rain. I will return and spend more time in Bruges and perhaps Antwerp and visit some friends there I've know for around eight years, though they too have gone their own ways in the Music field! There was one Dutch Master I visited when I went to Amsterdam for a holiday, some years back. I had originally gone for the "Floriad" - which was absolutely brilliant! However I visited some pumping stations and dykes as well as visiting Vincent Van Gock's Gallery. Now he was a real Dutch Master and I truly appreciate his works. northumbrian1.
northumbrian1
 
Posts: 17
Joined: Mon Sep 03, 2012 12:19 am
Location: northumberland


Return to Hints and tips

Who is online

Users browsing this forum: No registered users and 1 guest