← 返回命令列表

Linux command

pacman-key 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Initialize

sudo pacman-key --init

Example

sudo pacman-key --populate

List keys

pacman-key -l

Add

sudo pacman-key -a [path/to/keyfile.gpg]

Receive a key

sudo pacman-key -r "[uid|name|email]"

Example

pacman-key -f "[uid|name|email]"

Sign

sudo pacman-key --lsign-key "[uid|name|email]"

Remove

sudo pacman-key -d "[uid|name|email]"

说明

pacman-key is a wrapper around GnuPG for managing the keyring used by pacman to verify package signatures. It handles key initialization, importing, signing, and trust management. On a fresh Arch Linux installation, run --init to create the keyring, then --populate to add the official Arch Linux packager keys. For third-party repositories (like AUR helpers or custom repos), manually add and sign their keys. Key signing (--lsign-key) marks a key as trusted, allowing pacman to install packages signed by that key without warnings.

参数

--init
Initialize the pacman keyring
--populate
Reload the default keys from the archlinux-keyring package
-l, --list-keys
List keys from the public keyring
-a, --add _file_
Add keys from a file
-r, --recv-keys _keyid_
Fetch keys from a keyserver
-f, --finger _keyid_
Show key fingerprint
--lsign-key _keyid_
Locally sign a key (trust it)
-d, --delete _keyid_
Remove a key from the keyring
--refresh-keys
Update keys from the keyserver

FAQ

What is the pacman-key command used for?

pacman-key is a wrapper around GnuPG for managing the keyring used by pacman to verify package signatures. It handles key initialization, importing, signing, and trust management. On a fresh Arch Linux installation, run --init to create the keyring, then --populate to add the official Arch Linux packager keys. For third-party repositories (like AUR helpers or custom repos), manually add and sign their keys. Key signing (--lsign-key) marks a key as trusted, allowing pacman to install packages signed by that key without warnings.

How do I run a basic pacman-key example?

Run `sudo pacman-key --init` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --init do in pacman-key?

Initialize the pacman keyring