创建centos7下的加密移动硬盘

创建centos7下的加密移动硬盘

机器山插了一块移动硬盘,为了安全,使用了加密方法:

代码如下:

cryptsetup luksFormat /dev/sdb
cryptsetup luksOpen /dev/sdb cryp
dd if=/dev/urandom of=/root/keyfile1 bs=1024 count=4
chmod 0400 /root/keyfile1
cryptsetup luksAddKey /dev/sdb /root/keyfile1
mkfs.xfs /dev/mapper/cryp 
echo "/dev/mapper/cryp /mnt/1t xfs defaults 1 2" >> /etc/fstab
echo "cryp /dev/sdb /root/keyfile1 luks" >> /etc/crypttab
mount -a

参考:http://geekpeek.net/disk-encryption-on-centos-linux/

你可能感兴趣的:(LAMP)