请教如何修改LUKS密码

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
回复
Mfjetyc
帖子: 6
注册时间: 2017-01-05 16:01
系统: Windows 7

请教如何修改LUKS密码

#1

帖子 Mfjetyc » 2017-06-13 17:42

版本为Ubuntu 17.04,在安装中选择加密磁盘,也就是相当于Windows下的BitLocker加密C盘,现在是如何修改这个密码!请教大家!
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 请教如何修改LUKS密码

#2

帖子 poloshiao » 2017-06-13 18:01

如何修改这个密码
看看 能否幫上忙

https://help.ubuntu.com/16.04/servergui ... ther-utils
Other Utilities
ecryptfs-add-passphrase
adds a new passphrase to the kernel keyring

http://manpages.ubuntu.com/manpages/zes ... ase.1.html
ecryptfs-add-passphrase
add an eCryptfs mount passphrase to the kernel keyring.
/usr/share/doc/ecryptfs-utils/ecryptfs-faq.html
头像
flwwater
帖子: 759
注册时间: 2010-10-31 9:15
系统: kubuntu 24.04

Re: 请教如何修改LUKS密码

#3

帖子 flwwater » 2022-08-04 10:49

第一步 – 查询 /etc/crypttab 文件(非必要)
sudo cat /etc/crypttab

如下所示:

sda3_crypt UUID=42e50ed0-5055-45f5-b1fc-0f54669e6d1f none luks,discard>

sudo fdisk -l /dev/sda

/dev/sda3:

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: CT1000MX500SSD1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 1BB1DDD0-47F9-48FB-AA29-69D6A74F4D91

Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 1550335 499712 244M Linux filesystem
/dev/sda3 1550336 1953523711 1951973376 930.8G Linux filesystem


第二步 – 查询 LUKS 设备信息头(非必要)
sudo cryptsetup luksDump /dev/sda3

My LUKS disk/parition header info:

LUKS header information
Version: 2
Epoch: 4
Metadata area: 16384 [bytes]
Keyslots area: 16744448 [bytes]
UUID: 42e50ed0-5055-45f5-b1fc-0f54669e6d1f
Label: (no label)
Subsystem: (no subsystem)
Flags: (no flags)

Data segments:
0: crypt
offset: 16777216 [bytes]
length: (whole device)
cipher: aes-xts-plain64
sector: 512 [bytes]

Keyslots:
0: luks2
Key: 512 bits
Priority: normal
Cipher: aes-xts-plain64
Cipher key: 512 bits
PBKDF: argon2i
Time cost: 7
Memory: 1048576
Threads: 4
Salt: fc 9d b7 e0 ec 06 d0 b1 47 09 61 6f c1 73 f9 51
b7 ff 9b 6b 44 a0 2b c5 dd 5a c4 7e 46 28 c3 62
AF stripes: 4000
AF hash: sha256
Area offset:32768 [bytes]
Area length:258048 [bytes]
Digest ID: 0
Tokens:
Digests:
0: pbkdf2
Hash: sha256
Iterations: 136107
Salt: 40 82 65 fc cf e1 24 d3 0d b8 85 07 13 c7 dd a1
03 52 6a b9 04 b8 6d 23 4a d1 90 89 cb 96 a7 ca
Digest: 5b d0 10 56 e4 9a ff e1 eb 14 2a fb 4d 85 ba c3
a7 75 fa fa 6c 24 cc 01 b0 9c 34 dd 48 98 1a d9


第三步 – 查找admin或安装程序分配给您的LUKS插槽
sudo cryptsetup --verbose open --test-passphrase /path/to/dev/
sudo cryptsetup --verbose open --test-passphrase /dev/sda3


该命令将告诉您正确的LUKS插槽:

Enter passphrase for /dev/sda3:
Key slot 0 unlocked.
Command successful.


请记下插槽编号。换句话说,我们需要使用/dev/sda3的插槽号 0 .
第四步– 使用命令行更改Linux中的LUKS磁盘加密密码

sudo cryptsetup luksChangeKey /dev/sda3 -S 0

输出如下所示:
Enter passphrase to be changed: (这里输入原来的密码)
Enter new passphrase: (这里输入新的密码)
Verify passphrase: (这里确认新密码)


Step 5 – 确认密码
sudo cryptsetup --verbose open --test-passphrase /dev/sda3
上次由 flwwater 在 2023-01-14 9:48,总共编辑 2 次。
个人收藏的数百个精美动态壁纸:
https://url17.ctfile.com/d/15983117-593 ... 768?p=6220
(访问密码:6220


个人收藏的经典国语音乐和纯音乐(钢琴,笛子,二胡等):
https://url17.ctfile.com/d/15983117-446 ... 33e?p=6220
(访问密码:6220



如果访问密码不对,可试试这个密码 566816
zhangjint5
帖子: 304
注册时间: 2011-01-02 12:31

Re: 请教如何修改LUKS密码

#4

帖子 zhangjint5 » 2022-10-16 18:29

Mfjetyc 写了: 2017-06-13 17:42 版本为Ubuntu 17.04,在安装中选择加密磁盘,也就是相当于Windows下的BitLocker加密C盘,现在是如何修改这个密码!请教大家!
sudo cryptsetup luksChangeKey /dev/sdXx

其中 sdXx改成你的加密设备!
回复