更改 ecryptfs 目录的密码

The*_*eou 9 ecryptfs passphrase

我想要一个加密的目录(不是 homedir!)让我们说 /testdata。

我使用以下命令和参数对其进行加密:

root@pc:~# mount -t ecryptfs /testdata/ /testdata/
Passphrase: 
Select cipher: 
 1) aes: blocksize = 16; min keysize = 16; max keysize = 32
 2) blowfish: blocksize = 8; min keysize = 16; max keysize = 56
 3) des3_ede: blocksize = 8; min keysize = 24; max keysize = 24
 4) twofish: blocksize = 16; min keysize = 16; max keysize = 32
 5) cast6: blocksize = 16; min keysize = 16; max keysize = 32
 6) cast5: blocksize = 8; min keysize = 5; max keysize = 16
Selection [aes]: 
Select key bytes: 
 1) 16
 2) 32
 3) 24
Selection [16]: 
Enable plaintext passthrough (y/n) [n]: 
Enable filename encryption (y/n) [n]: y
Filename Encryption Key (FNEK) Signature [b9fc92f854a4c85b]: 
Attempting to mount with the following options:
  ecryptfs_unlink_sigs
  ecryptfs_fnek_sig=b9fc92f854a4c85b
  ecryptfs_key_bytes=16
  ecryptfs_cipher=aes
  ecryptfs_sig=b9fc92f854a4c85b
WARNING: Based on the contents of [/root/.ecryptfs/sig-cache.txt],
it looks like you have never mounted with this key 
before. This could mean that you have typed your 
passphrase wrong.

Would you like to proceed with the mount (yes/no)? : yes
Would you like to append sig [b9fc92f854a4c85b] to
[/root/.ecryptfs/sig-cache.txt] 
in order to avoid this warning in the future (yes/no)? : yes
Successfully appended new sig to user sig cache file
Mounted eCryptfs
Run Code Online (Sandbox Code Playgroud)

此命令创建此文件:

root@pc:~# cat .ecryptfs/sig-cache.txt 
b9fc92f854a4c85b
Run Code Online (Sandbox Code Playgroud)

现在我想更改我之前使用的密码。我找到了ecryptfs-rewrap-passphrase命令,但我不确定我是否在正确的道路上:

root@pc:~# ecryptfs-rewrap-passphrase .ecryptfs/sig-cache.txt 
Old wrapping passphrase: 
New wrapping passphrase: 
New wrapping passphrase (again): 
Error: Unwrapping passphrase failed [-5]
Info: Check the system log for more information from libecryptfs
Run Code Online (Sandbox Code Playgroud)

/var/log/syslog 说:

Jul 13 13:16:19 pc ecryptfs-rewrap-passphrase: ecryptfs_unwrap_passphrase: PK11_CipherOp() error; SECFailure = [-1]; PORT_GetError() = [-8188]
Run Code Online (Sandbox Code Playgroud)

我有一个关于 ecryptfs 的新手状态,我希望在这里得到一些启发。

小智 10

我看到您正在尝试将密码推送到具有其他含义的文件中。

ecryptfs-rewrap-passphrase /home/.ecryptfs/$USER/.ecryptfs/wrapped-passphrase 
Run Code Online (Sandbox Code Playgroud)

或者当然……但最好wrapped-passphrase.ecryptfs隐藏目录中手动搜索:

ecryptfs-rewrap-passphrase /home/$USER/.ecryptfs/wrapped-passphrase
Run Code Online (Sandbox Code Playgroud)

我认为这是更改密码的正确命令,$USER您的用户在哪里

PS:最好不要登录并解密您的文件夹。