← 返回命令列表

Linux command

cryptsetup 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

cryptsetup luksFormat /dev/sda1

Open

cryptsetup open /dev/sda1 mapping_name

Example

cryptsetup status mapping_name

Close

cryptsetup close mapping_name

Change

cryptsetup luksChangeKey /dev/sda1

说明

cryptsetup manages dm-crypt and LUKS (Linux Unified Key Setup) encrypted volumes. It provides disk encryption for protecting data at rest, supporting multiple key slots, strong encryption algorithms, and header backup/restore.

参数

luksFormat _device_
Initialize a LUKS encrypted volume (destroys all data)
open _device_ _name_
Open encrypted device and create mapping at /dev/mapper/name
close _name_
Remove an existing mapping
status _name_
Display information about an active mapping
luksChangeKey _device_
Change the passphrase for a LUKS volume
luksAddKey _device_
Add a new passphrase to a key slot
luksRemoveKey _device_
Remove a passphrase from a key slot
luksDump _device_
Display LUKS header information
luksHeaderBackup _device_
Backup LUKS header to a file
isLuks _device_
Check if device is a LUKS volume
benchmark
Benchmark encryption algorithms
--type _type_
Specify encryption type (luks, luks2, plain)
--cipher _cipher_
Encryption cipher specification
--key-size _bits_
Encryption key size in bits
--hash _hash_
Hash algorithm for LUKS header

FAQ

What is the cryptsetup command used for?

cryptsetup manages dm-crypt and LUKS (Linux Unified Key Setup) encrypted volumes. It provides disk encryption for protecting data at rest, supporting multiple key slots, strong encryption algorithms, and header backup/restore.

How do I run a basic cryptsetup example?

Run `cryptsetup luksFormat /dev/sda1` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does luksFormat _device_ do in cryptsetup?

Initialize a LUKS encrypted volume (destroys all data)