Olg*_*ga 15 linux fedora encryption
如何在 Fedora 20 中验证硬盘驱动器是否加密?
如果没有,是否意味着我必须重新安装 Fedora 才能对其进行加密?
lud*_*egu 27
假设驱动器是/dev/sdb,并且您要检查的分区是/dev/sdb1,请运行以下命令:
$ blkid /dev/sdb1
Run Code Online (Sandbox Code Playgroud)
如果分区是否加密,输出将改变:
/dev/sdb1: UUID="xxxxxxxxxxxx" TYPE="crypto_LUKS" #encrypted
/dev/sdb1: UUID="xxxxxxxxxxxx" TYPE="ext4" #not encrypted, fs is ext4
Run Code Online (Sandbox Code Playgroud)
如果分区未加密,并且假设您没有尝试加密/分区,则必须:
将分区初始化为加密
$ cryptsetup luksFormat /dev/sdb1
Run Code Online (Sandbox Code Playgroud)注意:此命令将擦除分区的所有内容!!!
它会要求您输入密码来打开卷;现在如果你尝试运行blkid,输出应该是TYPE="crypto_LUKS"
打开加密分区使用
$ cryptsetup luksOpen /dev/sdb1 secret
Run Code Online (Sandbox Code Playgroud)其中“ secret”是我们打开的卷的名称
格式化新的“ secret”卷
$ mkfs.ext4 /dev/mapper/secret
Run Code Online (Sandbox Code Playgroud)安装它提供之前创建的密码
$ mount /dev/mapper/secret /whereyouwant
Run Code Online (Sandbox Code Playgroud)
现在您应该可以使用加密分区了!
或者,如果您想在重新启动时挂载它,您应该编辑/etc/crypttab并插入与此类似的行(它会在启动时请求密码):
secret /dev/sdb1 none
Run Code Online (Sandbox Code Playgroud)
secret我们之前创建的卷的名称在哪里。
或者类似的东西,如果你想把你的密码放在一些纯文本文件中:
secret /dev/sdb1 /whereyouwant-sdb1-luks-pwdfile
Run Code Online (Sandbox Code Playgroud)
请记住这一点,您还必须添加密钥:
$ cryptsetup luksAddKey /dev/sdb1 /whereyouwant-sdb1-luks-pwdfile
Run Code Online (Sandbox Code Playgroud)
并编辑/etc/fstab并插入与此类似的行:
/dev/mapper/secret /whereyouwant ext4 defaults 1 2
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
55473 次 |
| 最近记录: |