• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

apt-key Command Examples in Linux

by admin

apt-key is a command-line utility that is used to manage the authentication keys that are used to authenticate packages. It is a part of the apt package manager, which manages packages on Debian-based systems.

The apt-key command is used to manage the authentication keys that are used to authenticate packages. These keys are used to verify the integrity and authenticity of the packages that are installed on the system.

Some of the common options for the apt-key command include the following:

  • add: Add a new key to the keyring.
  • adv: Run an advanced key server command.
  • del: Remove a key from the keyring.
  • export: Export one or more keys from the keyring.
  • import: Import one or more keys into the keyring.
  • list: List the keys in the keyring.

Here is an example of how apt-key can be used to add a new key to the keyring:

# apt-key add /path/to/key.asc

This command adds the key stored in the file /path/to/key.asc to the keyring. The key can then be used to authenticate packages. You can learn more about the apt-key command and its options by reading the apt-key man page or by typing apt-key –help at the command prompt.

apt-key Command Examples

1. List trusted keys:

# apt-key list

2. Add a key to the trusted keystore:

# apt-key add {{public_key_file.asc}}

3. Delete a key from the trusted keystore:

# apt-key del {{key_id}}

4. Add a remote key to the trusted keystore:

# wget -qO - {{https://host.tld/filename.key}} | apt-key add -

5. Add a key from keyserver with only key id:

# apt-key adv --keyserver {{pgp.mit.edu}} --recv {{KEYID}}
Note: apt-key is now deprecated (except for the use of apt-key del in maintainer scripts).

Filed Under: Linux

Some more articles you might also be interested in …

  1. at Command Examples in Linux
  2. kpackagetool5 Command Examples in Linux
  3. CentOS / RHEL : How to find UUID of a device or filesystem
  4. Why Does a Lun World Wide ID Starts with the Number 3 in Linux dm-multipath
  5. How to Start, Stop, Restart, Check Status IIS Service by Command Line
  6. How to Install dmg File on Mac from Command Line
  7. usermod Command Examples in Linux
  8. Configuring Remote Logging using rsyslog in CentOS/RHEL
  9. more: command not found
  10. How to add additional language support in CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright