Linux command
keyctl 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List
keyctl list @us
Add
keyctl add user keyname "keyvalue" @us
Example
echo -n "value" | keyctl padd user keyname @us
Read
keyctl read keyid
Pipe
keyctl pipe keyid
Example
keyctl timeout keyid 3600
Revoke
keyctl revoke keyid
Clear
keyctl clear @us
说明
keyctl is a utility for managing the Linux kernel keyring facility. It allows creating, modifying, and querying keys and keyrings that can store authentication tokens, encryption keys, and other security-related data.
参数
- add TYPE NAME DATA KEYRING
- Create a new key and attach it to a keyring
- padd TYPE NAME KEYRING
- Add a key with payload from stdin
- request TYPE NAME DEST_KEYRING
- Request a key from the kernel
- update KEY DATA
- Update a key's payload
- newring NAME KEYRING
- Create a new keyring
- revoke KEY
- Revoke a key, preventing further operations
- clear KEYRING
- Remove all keys from a keyring
- unlink KEY KEYRING
- Remove a key from a keyring
- search KEYRING TYPE DESCRIPTION DEST_KEYRING
- Search for a key in a keyring
- read KEY
- Read and display a key's payload
- pipe KEY
- Output a key's payload without formatting
- list KEYRING
- List keys in a keyring
- describe KEY
- Display key attributes
- timeout KEY SECONDS
- Set a key's expiration time
- setperm KEY MASK
- Set key permissions
FAQ
What is the keyctl command used for?
keyctl is a utility for managing the Linux kernel keyring facility. It allows creating, modifying, and querying keys and keyrings that can store authentication tokens, encryption keys, and other security-related data.
How do I run a basic keyctl example?
Run `keyctl list @us` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does add TYPE NAME DATA KEYRING do in keyctl?
Create a new key and attach it to a keyring