可以使用--readonly或-r选项调用 cryptsetup ,这将设置只读映射:
cryptsetup --readonly luksOpen /dev/sdb1 sdb1
Run Code Online (Sandbox Code Playgroud)
以只读方式打开设备后,我可以稍后将其重新映射为读写吗?显然,我的意思是将它映射为读写而不先关闭它,然后再打开它。我可以重新映射它而不必再次输入密码吗?
如果这是不可能的,这只是 cryptsetup 不支持这一点,还是有一些更基本的层面?
我有一个双启动的 Windows 7 和 Linux Mint。在 Windows 7 中,我有 2 个分区,1 个用于系统 (C:),另一个用于数据 (D:)。数据分区使用 Bitlocker 加密。我可以在 Windows 7 中使用它,因为我有密码。
Linux Mint 会自动挂载 Windows 7 分区(类型 HPFS/NTFS,位于/dev/sda2),因此我可以在文件管理器(Nemo 或 Thunar)中看到该分区。但是我看不到我的数据分区(类型 HPFS/NTFS,在/dev/sda3)。
我的系统信息如下:
$ inxi -S
System: Host: desktop Kernel: 3.19.0-32-generic x86_64 (64 bit)
Desktop: Cinnamon 2.8.8 Distro: Linux Mint 17.3 Rosa
$ cat /proc/version
Linux version 3.19.0-32-generic (buildd@lgw01-43) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015
Run Code Online (Sandbox Code Playgroud)
如何在 Linux 上访问加密分区中的数据?
在ubuntu 20.04 上设置休眠并将其修改为适用于加密交换分区后,我遇到了几个问题:
首先,从休眠状态重新启动后,我收到“放弃等待挂起/恢复设备”以及“未找到卷组 luks”。幸运的是,我之后可以正常启动系统。
尽管如此,当再次执行上述网站的步骤时,我在执行时收到以下错误和警告sudo update-initramfs -c -k all:
update-initramfs: Generating /boot/initrd.img-5.4.0-56-generic
cryptsetup: ERROR: Couldn't resolve device
/dev/disk/by-uuid/5834cf70-0919-4c53-98a6-355d69bbd6a4
cryptsetup: ERROR: Couldn't resolve device
UUID=5834cf70-0919-4c53-98a6-355d69bbd6a4
cryptsetup: WARNING: target 'sda3_crypt' not found in /etc/crypttab
update-initramfs: Generating /boot/initrd.img-5.4.0-58-generic
cryptsetup: ERROR: Couldn't resolve device
/dev/disk/by-uuid/5834cf70-0919-4c53-98a6-355d69bbd6a4
cryptsetup: ERROR: Couldn't resolve device
UUID=5834cf70-0919-4c53-98a6-355d69bbd6a4
cryptsetup: WARNING: target 'sda3_crypt' not found in /etc/crypttab
Run Code Online (Sandbox Code Playgroud)
请注意,UUID=5834cf70-0919-4c53-98a6-355d69bbd6a4属于以前未加密的交换分区sda3。我用我知道的每个配置文件(见下文)UUID中的加密分区之一替换了它sda3_crypt。
我希望通过以下打印输出可以解决问题。涉及的配置文件内容(关于swap分区)是:
1. /etc/fstab
/dev/mapper/sda3_crypt none swap sw …Run Code Online (Sandbox Code Playgroud) 我有以下问题。我的笔记本电脑已使用 LVM 完全加密,我知道密码,但分区表已损坏。在本例中,我从 USB 记忆棒 sdb1 启动。有希望让 /dev/sda2 再次工作吗?sda1 ist mountable 如果我尝试启动,我将陷入 initframs,找不到卷组。
系统是Linux Mint Qiana。
sudo fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000ca01e
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 499711 248832 83 Linux
/dev/sda2 501758 976771071 …Run Code Online (Sandbox Code Playgroud) 有没有一种简单的方法可以加密我完全满的 2To 硬盘,而无需购买另一种格式/加密驱动器,然后最终将所有数据传输过来?
我目前正在为一位朋友从笔记本电脑中取出的内部硬盘恢复一些数据,并使用 LUKS 进行加密。他们无法告诉我更多其他信息,因为其他人为他们加密了它,但他们确实知道密码,而且它运行的是 Linux 操作系统。我希望解密数据,然后将其恢复到第二个 USB 设备上。
我使用以下命令来解密它:-
losetup /dev/loop1 /mnt/hdd #hdd being the encrypted disk
mmls /mnt/hdd #just to check it has mounted
Run Code Online (Sandbox Code Playgroud)
退货:-
DOS Partition table
Offset Sector: 0
000 .... Primary Table
001 .... Unallocated
002 .... Linux
003 .... Linux
004 .... Unallocated
kpartx -a /dev/loop1
kpartx -l /dev/loop1
Run Code Online (Sandbox Code Playgroud)
返回:
loop1p1: 0 1024000 /dev/loop1 2048
loop1p2: 0 624115712 /dev/loop1 1026048
Run Code Online (Sandbox Code Playgroud)
然后我输入命令:
cryptsetup luksOpen /dev/mapper/loop1ps decrypted-directory --verbose
Run Code Online (Sandbox Code Playgroud)
我输入密码
Key slot 1 unlocked
Run Code Online (Sandbox Code Playgroud)
然后它挂起,没有进一步的输出。根据我的阅读,它应该在控制台上打印“命令成功”,但这似乎没有发生。我也将其放置了 12 个多小时,以防这是解密过程。
我认为这不是解密过程,因为我认为会有一些详细的日志记录到终端?
有一天,当我打开计算机时,我的 home 部分 /dev/sda7 的密码不起作用(我 147% 绝对确定,我写的是正确的密码)!经过三次尝试,我通过强制关机重新启动计算机并尝试输入相同的密码。那没有用。然后,我选择了“Boot arch with Linux linux”,而不是默认引导“Boot arch”。这对我有帮助。我关掉电脑后工作了一整天。但在下次启动时,这个技巧对我没有帮助。甚至选择“Boot arch with Linux linux (initramfs Fallback)”(我只有 3 个启动选项)。然后我决定从 Ubuntu LiveUSB 启动。sudo cryptsetup luksOpen /dev/sda7 home说:No key available with this passphrase.
我已经尝试执行了sudo cryptsetup --verbose repair /dev/sda7,上面说的No known problems detected for LUKS header.。我已经编译并执行了官方 cryptsetup 工具https://gitlab.com/cryptsetup/cryptsetup/tree/master/misc/keyslot_checker用于检查密钥槽。它说了有关键槽的相同信息,即 luksDump。
$ sudo cryptsetup
LUKS header information for /dev/sda7
Version: 1
Cipher name: aes
Cipher mode: xts-plain64
Hash spec: sha256
Payload offset: 4096
MK bits: 256 …Run Code Online (Sandbox Code Playgroud) 在我的 QNAP 设备出现问题之后,我不得不对数据进行大量手动恢复,并且只能获取我的加密数据。
似乎 QNAP 使用 eCryptFS 来做到这一点。我设法设置了密码短语(使用ecryptfs-add-passphrase --fnek)并使用以下命令安装了文件系统:
mount /mnt/md3/.__eN__securedocs/ /mnt/md3/documents/Secure/ -t ecryptfs \
-o rw,ecryptfs_sig=b04b010ba4c32521,ecryptfs_fnek_sig=4f23065f483e5b1c,ecryptfs_unlink_sigs,relatime,ecryptfs_cipher=aes,ecryptfs_key_bytes=32
Run Code Online (Sandbox Code Playgroud)
我可以看到我的文件,但权限处于我以前从未见过的状态,使它们无法与之交互,甚至不足以复制:
[~] # ll /mnt/md3/documents/Secure/
/bin/ls: cannot access /mnt/md3/documents/Secure/battle.net.txt: No such file or directory
/bin/ls: cannot access /mnt/md3/documents/Secure/steam.txt: No such file or directory
/bin/ls: cannot access /mnt/md3/documents/Secure/Work: No such file or directory
/bin/ls: cannot access /mnt/md3/documents/Secure/Passport Application Declaration.pdf: No such file or directory
/bin/ls: cannot access /mnt/md3/documents/Secure/Bills: No such file or directory
/bin/ls: cannot access /mnt/md3/documents/Secure/Car: No such file or directory …Run Code Online (Sandbox Code Playgroud) 有一种方法可以在Ubuntu上获得加密交换 + 休眠。还有一种方法可以在 nixos 上获得加密交换(使用 randomEncryption.enable = true),以及一种使 hibernate 进行交换的方法。有没有办法休眠加密交换?
disk-encryption ×10
encryption ×6
cryptsetup ×4
dm-crypt ×2
swap ×2
btrfs ×1
ecryptfs ×1
fedora ×1
initramfs ×1
linux ×1
linux-mint ×1
luks ×1
lvm ×1
nixos ×1
ntfs ×1
partition ×1
qnap ×1
windows ×1