我刚刚使用以下方法加密了我的主文件夹,没有任何问题
ecryptfs-migrate-home
但是,当谈到加密交换时,情况就不同了。
sudo ecryptfs-setup-swap
[sudo] password for ratatouyee:
WARNING:
An encrypted swap is required to help ensure that encrypted files are not leaked to disk in an unencrypted format.
HOWEVER, THE SWAP ENCRYPTION CONFIGURATION PRODUCED BY THIS PROGRAM WILL BREAK HIBERNATE/RESUME ON THIS SYSTEM!
NOTE: Your suspend/resume capabilities will not be affected.
Do you want to proceed with encrypting your swap? [y/N]: y
INFO: Setting up swap: [/dev/sda6]
WARNING: Commented out your unencrypted swap from /etc/fstab
/dev/sda6 is already marked as no-auto
swapon: stat of /dev/mapper/cryptswap1 failed: No such file or directory
交换变得不可用,所以我必须恢复我的 fstab 和 crypttab 文件,然后 swapon -a,但交换当然没有加密。
答案1
这是由于 ecryptfs-utils 中的一个错误造成的。
步骤1
打开/etc/crypttab
并替换:
cryptswap1 UID=XXXXXXXX /dev/urandom swap,offset=1024,cipher=aes-xts-plain64
和:
cryptswap1 /swapfile /dev/urandom swap,offset=1024,cipher=aes-xts-plain64
第2步
打开/etc/fstab
并确保其以以下内容结尾:
#/swapfile none swap sw 0 0
/dev/mapper/cryptswap1 none swap sw 0 0
步骤3
重启电脑,重启后验证交换文件是否加密:
sudo cryptsetup status cryptswap1
它应该显示:
/dev/mapper/cryptswap1 is active and is in use.
参考: