How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (2024)

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

Are you looking for a solution to remove the apt-key in Linux? If yes, read this article. Here, I will provide 3 easy methods about how to remove the apt-key from a Linux system. apt-key is basically a part of the apt package manager that manages the apt keys and ensures package authentication. However, if you feel like deleting some keys that are unnecessary, you can do it by following some easy steps. Usually, Debian-based distro like Ubuntu uses this apt-key to remove, add, or manage keys of the packages. Therefore, welcome to this article to all Debian-based distro users.

Process flow chart to remove apt-key in Linux:

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (2)

[Distro Used Throughout the Tutorial: Ubuntu 22.04.1 LTS]

Table of Contents

3 Practical Methods to Remove Apt-key in Linux

In Linux, the apt-key manager is used by the Debian-based derivatives such as Ubuntu, Linux Mint, Kali Linux, etc. to manage keys. However, it is deprecated in the latest version of these distributions. Moreover, you can use the GUI to remove the apt-key. I will discuss every method elaborately in this section so read attentively.

You can read our Comparative Analysis of Methods to distinguish between these two methods and pick one for your needs.

Method 01: Removing Apt-Key Using the “apt-key” Manager

Though this command is the most well-known command in the Linux community to manage keys, it is not recommended for use in the current version of the Linux systems. However, it still works in the current version of Ubuntu. Follow the cases to know the process in detail.

Case 01: Removing Apt-Key Using the key Fingerprint

Fingerprint refers to the 10-block hex string of the key file which varies from key to key. So you can use it to specify the key you want to remove. Now, check the process of removal using the apt-key command with the key fingerprint:

Steps to Follow >

➊ Open the Ubuntu terminal.

➋ Write his command to list the key using the apt-key command:

sudo apt-key list

EXPLANATION

  • sudo: Permits administrative privileges.
  • apt-key: Manages keys used by apt in Debian-based Linux system.
  • list: Lists the keys.

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (3)

In this picture, you can see all the keys and their fingerprints after typing the password and pressing ENTER. Now select the key fingerprint that you want to remove. Here, I am removing the key shown in the yellow box.

➌ Write this command to remove the selected key:

sudo apt-key del "8439 38DF 228D 22F7 B374 2BC0 D94A A3F0 EFE2 1092"

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (4)

After typing the Ubuntu password, the key will be deleted from the system.

➍ When all the task is done, update the packages by writing this code:

sudo apt update

EXPLANATION

  • update: Updates all the packages in Linux.

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (5)

All the packages and keys have been updated now.

Case 02: Removing Apt-Key Using the “key_ID”

Using key_ID is the easiest way to remove the apt-key. It is the key identification number which is the last 8 characters of the key fingerprint. Hence, it is simpler and more user-friendly ways than using the long 10-block fingerprint. In order to do this process, check the steps below:

Steps to Follow >

➊ Open the Ubuntu terminal.

Check the key list by following Step 02 Case 01 under Method 01.

➋ Afterward, select the key_ID and run the following command to remove it:

sudo apt-key del EFE21092

EXPLANATION

  • EFE21092: Key_ID.

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (6)

When you type your Ubuntu password, the key will be removed.

After deleting the key, update the packages by following Steps 04 Case 01 under Method 01.

➌ You can check the key list again to verify that the selected key has been removed successfully.

Now run this code to check that:

sudo apt-key list

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (7)

You can notice in this image that the key is no longer here.

Method 02: Removing Apt-key Directly From the Keyring File

The apt keysare stored in the keyring file. You can find the keyring file in the /etc/apt/trusted.gpg.d location in Ubuntu. After finding the file, you can manually remove the file to remove the apt-key. Here are the steps:

Steps to Follow >

➊ Open the Ubuntu terminal.

➋ Find the keyring file by executing this command:

ls /etc/apt/trusted.gpg.d/

EXPLANATION

  • ls /etc/apt/trusted.gpg.d/: Lists the keys stored in the /etc/apt/trusted.gpg.d location.

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (8)

In this picture, you can see the list of key files in the /etc/apt/trusted.gpg.d/ directory.

➌ Write the following code to remove the key:

sudo rm /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg

EXPLANATION

  • rm: Command to remove files, directories, and links.
  • /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg: Location of the key file named ‘ubuntu-keyring-2018-archive.gpg’.

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (9)

After running this command, the key file will be removed from your system.

Now, follow Steps 04 Case 01 under Method 01to update the packages.

➍ To verify the removal of the apt-key, now run this command:

ls /etc/apt/trusted.gpg.d/

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (10)

You can notice that the key file is successfully deleted from the Linux system.

Method 03: Removing Apt-key Using GUI

Don’t worry if you find it difficult to run code in the terminal. Use this GUI (Graphical User Interface) based approach to complete the removal procedure with just some clicks. Check the steps carefully:

Steps to Follow >

➊ Click ‘Show Applications’ and open ‘Software & Updates’.

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (11)

➋ Go to the ‘Authentication’ tab of the ‘Software & Updates’ to check the key. Select the key and click the ‘remove’ option.

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (12)

As soon as you click the remove button, an authentication window will come up.

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (13)

Type your Ubuntu password and click ‘Authenticate’ to remove the key successfully.

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (14)

Now, you can notice that there is no key. So finally, you are done with the removal procedure.

Comparative Analysis of Methods to Remove Apt-key in Linux

Here, I will explain to you the advantages and disadvantages that each method provides to remove the apt-key in Linux. To find your best pick, go through this table:

MethodsProsCons
Method 1
  • Provides a straightforward way to remove apt-key.
  • Offers automatic updates.
  • Deprecated in the latest version of Ubuntu.
  • Less control over the key management.
Method 2
  • Direct control over the keys.
  • Much secure.
  • Irreversible method.
  • Manual procedure.
Method 3
  • Less prone to typing mistakes.
  • User-friendly and convenient.
  • Offers limited function.
  • May create security issues.

I hope this table helps you find your best approach to remove the apt-key. If you feel any difficulty understanding the command-based approach, go for method 3. Otherwise, method 2 is great to use. If you are afraid of irreversible methods then pick method 1.

Conclusion

I sincerely hope that this guide aids you in removing the apt-key you intended to do so. Here, 3approaches have been explored step-by-step. apt-key command is used to manage the keys used by the advanced package tool. Two practical cases involving apt-key (key_ID and key fingerprint) have been described. Additionally, you have the option of deleting the key right from the keyring file. Last but not least, after deleting the key, remember to update the packages. Good luck!

People Also Ask

How do I remove apt-key and repository?

In order to remove a repository using Ubuntu’s old apt-key command, you must first find the keyring file containing the repository’s key and then use the rm command to remove that file.

How to remove repository list in Linux?

To remove the repository list in Linux, run this code with sudo privileges: ‘sudo rm /etc/apt/sources.list.d/<Repo_Filename>.list’.

How to remove a specific repository using apt?

In Ubuntu to remove a specific repository using apt, you will need the repository name then run this code in the terminal ‘sudo add-apt-repository –remove ppa:<PPA_NAME>’.

What is apt-key in Linux?

Apt-key is the command-line tool used to manage authentication keys used by the apt package manager to authenticate software packages downloaded from the repositories. It works like a digital signature.


Related Articles

  • How to Uninstall RPM in Linux [2 Simple Cases]
  • How to Uninstall a YUM Package [2 User-Friendly Cases]
  • How to Remove a Specific Version Using YUM [2 Easy Methods]
  • How to Force Remove a Package Without Dependencies Using Yum [2 Methods]
  • How to Remove and Purge a Package Using apt-get [4 Methods]
  • How to Remove Package and Dependencies Using dpkg [4 Cases]

<< Go Back to Uninstall Packages in Linux | Package Management in Linux | Learn Linux Basics

5/5 - (10 votes)

How to Remove Apt-key in Linux [3 Practical Methods] - LinuxSimply (2024)
Top Articles
What are the Different Phases of Real Estate Syndication? - GowerCrowd
ARUCS
Mickey Moniak Walk Up Song
Creepshotorg
How To Fix Epson Printer Error Code 0x9e
Play FETCH GAMES for Free!
UPS Paketshop: Filialen & Standorte
Faint Citrine Lost Ark
Tesla Supercharger La Crosse Photos
Sarah F. Tebbens | people.wright.edu
Legacy First National Bank
Our History | Lilly Grove Missionary Baptist Church - Houston, TX
83600 Block Of 11Th Street East Palmdale Ca
Pollen Count Central Islip
Athens Bucket List: 20 Best Things to Do in Athens, Greece
6813472639
Dr. med. Uta Krieg-Oehme - Lesen Sie Erfahrungsberichte und vereinbaren Sie einen Termin
Elemental Showtimes Near Cinemark Flint West 14
Violent Night Showtimes Near Amc Fashion Valley 18
Kylie And Stassie Kissing: A Deep Dive Into Their Friendship And Moments
UPS Store #5038, The
Azpeople View Paycheck/W2
Amortization Calculator
Puretalkusa.com/Amac
Jordan Poyer Wiki
Sadie Sink Reveals She Struggles With Imposter Syndrome
Wiseloan Login
Myql Loan Login
Beaufort 72 Hour
8002905511
Annapolis Md Craigslist
Sacramento Craigslist Cars And Trucks - By Owner
Bursar.okstate.edu
Armor Crushing Weapon Crossword Clue
Brenda Song Wikifeet
15 Downer Way, Crosswicks, NJ 08515 - MLS NJBL2072416 - Coldwell Banker
Uhaul Park Merced
Bbc Gahuzamiryango Live
7543460065
Cbs Fantasy Mlb
National Insider Threat Awareness Month - 2024 DCSA Conference For Insider Threat Virtual Registration Still Available
Chatropolis Call Me
Craiglist Hollywood
Cnp Tx Venmo
Umd Men's Basketball Duluth
Alston – Travel guide at Wikivoyage
Shipping Container Storage Containers 40'HCs - general for sale - by dealer - craigslist
What to Do at The 2024 Charlotte International Arts Festival | Queen City Nerve
Nu Carnival Scenes
Is Chanel West Coast Pregnant Due Date
Definition of WMT
All Obituaries | Roberts Funeral Home | Logan OH funeral home and cremation
Latest Posts
Article information

Author: Dean Jakubowski Ret

Last Updated:

Views: 6272

Rating: 5 / 5 (70 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Dean Jakubowski Ret

Birthday: 1996-05-10

Address: Apt. 425 4346 Santiago Islands, Shariside, AK 38830-1874

Phone: +96313309894162

Job: Legacy Sales Designer

Hobby: Baseball, Wood carving, Candle making, Jigsaw puzzles, Lacemaking, Parkour, Drawing

Introduction: My name is Dean Jakubowski Ret, I am a enthusiastic, friendly, homely, handsome, zealous, brainy, elegant person who loves writing and wants to share my knowledge and understanding with you.