硬盘加密挂载
摘要
利用cryptsetup
可以实现对硬盘的加密挂载,本文简单介绍如何使用
参考:https://blog.csdn.net/yifan850399167/article/details/80170215
加密初始化
# 加密某个硬盘的某个分区
cryptsetup luksFormat /dev/sdc1
# 要键入YES,并设置密码
# 解密这个分区,并进行硬着
cryptsetup open /dev/sdc1 fgn-disk-mapper
# 要输入密码
ll /dev/mapper/
lrwxrwxrwx. 1 root root 7 Nov 23 18:29 fgn-disk-mapper -> ../dm-2
# 格式化这个解密分区,然后挂载
mkfs.ext4 /dev/mapper/fgn-disk-mapper
mount /dev/mapper/fgn-disk-mapper /mnt/fgn-disk/
# 解除挂载并解除映射
umount /mnt/fgn-disk/
cryptsetup close fgn-disk-mapper
挂载
cryptsetup open /dev/sdc1 fgn-disk-mapper
# 要输入密码
mount /dev/mapper/fgn-disk-mapper /mnt/fgn-disk/
解挂
umount /mnt/fgn-disk/
cryptsetup close fgn-disk-mapper