4、選擇加密后的文件系統格式
由于我們將加密磁盤用于Linux系統的,因此選擇Linux Ext4
Filesystem:
1) None
2) FAT
3) Linux Ext2
4) Linux Ext3
5) Linux Ext4
6) NTFS
7) exFAT
Select [2]: 5
5、輸入密碼
Enter password:
WARNING: Short passwords are easy to crack using brute force techniques!
We recommend choosing a password consisting of 20 or more characters. Are you sure you want to use a short password? (y=Yes/n=No) [No]: yes
Re-enter password:
由于我這里用于演示的密碼太短,系統提示我當前密碼很容易被暴力破解,建議使用20個字符以上的密碼,是否還要使用當前密碼。這里輸入yes 接著系統會讓你再次輸入一次密碼:Re-enter password:
6、輸入PIM
接下來系統會讓你輸入PIM。
Enter PIM:
這個PIM是什么?我上網查了一下,就是Personal Iterations Multiplier”的縮寫。通俗地說就是:你可以自定義“加密盤的頭部密鑰生成時的迭代次數”。這個“迭代次數”越大,計算頭部密鑰的時間就越長,因此掛載加密盤的過程就越慢;表面上看,這是一個缺點。但其好處在于:如果某個攻擊者想要采用暴力破解的方式對“頭部”進行窮舉解密,每次一次嘗試也同樣需要花很長時間(同樣要迭代 N 次)。所以,當 N 足夠大,暴力破解就變得不可行。 如果你設置的密碼過于簡短,那么 VeraCrypt 會強制讓你輸入一個比較大的 PIM 數值(大于 485)。 如果你創建加密盤的時候,指定了 PIM 數值,那么在掛載的時候,需要輸入【相同的】PIM 數值。 如果輸入的數值與創建時指定的 PIM 數值不一致,則掛載失敗。 這里我們直接回車就可以.
7、輸入keyfile
接下來,指定keyfile
Enter keyfile path [none]:
這里我們先不指定,所以直接回車。
8、輸入320個隨機字符
在鍵盤上隨意輸入字符,如果不知道輸入的數量夠不夠,可以回車,向導就會提示你還剩多少個字符沒有輸入了:
Please type at least 320 randomly chosen characters and then press Enter:
Characters remaining: 277
Characters remaining: 172
Characters remaining: 88
Characters remaining: 31
當輸入的隨機字符數量符合要求后,向導就開始創建加密盤了:
Done: 9.946% Speed: 89 MB/s Left: 81 s
全部完成后會有如下提示
Done: 100.000% Speed: 88 MB/s Left: 0 s
The VeraCrypt volume has been successfully created.
(二)掛載加密磁盤
1、掛載加密磁盤
掛載由veracrypt加密的磁盤和掛載普通磁盤的命令不一樣,不能使用mount。 在未掛載前使用fdisk -l命令查看的話,磁盤還是沒有分區和格式化的狀態:
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x330ad122在這種狀態下是沒有辦法使用mount命令的。
正確的方法是使用命令 veracrypt /dev/sdb /mnt:
[root@localhost src]# veracrypt /dev/sdb /mnt
Enter password for /dev/sdb:
Enter PIM for /dev/sdb:
Enter keyfile [none]:
Protect hidden volume (if any)? (y=Yes/n=No) [No]:這時系統會提示是輸入加密磁盤時預留的密碼,后三項可以直接回車略過。
2、查看磁盤掛載情況
這里再使用fdisk -l命令查看的話,在原來的磁盤/dev/sda、/dev/sdb的基礎上會多出一個/dev/mapper/veracrypt1磁盤,這就是掛載上來加密磁盤:
Disk /dev/mapper/veracrypt1: 8589 MB, 8589672448 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
使用 df -h命令查看可以看到/dev/mapper/veracrypt1已經掛載到/mnt目錄上了。
[root@localhost src]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 47G 1001M 43G 3% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/sda1 976M 80M 845M 9% /boot
/dev/mapper/veracrypt1
7.8G 18M 7.4G 1% /mnt3、嘗試訪問和寫入文件
3、嘗試訪問和寫入文件
[root@localhost src]# cd /mnt
[root@localhost mnt]# ll
總用量 16
drwx------. 2 root root 16384 2月 6 21:35 lost+found
[root@localhost mnt]# touch 1.txt
[root@localhost mnt]# ll
總用量 16
-rw-r--r--. 1 root root 0 2月 6 21:48 1.txt
drwx------. 2 root root 16384 2月 6 21:35 lost+found
[root@localhost mnt]# echo "text" >2.txt
[root@localhost mnt]# ll
總用量 20
-rw-r--r--. 1 root root 0 2月 6 21:48 1.txt
-rw-r--r--. 1 root root 5 2月 6 21:49 2.txt
drwx------. 2 root root 16384 2月 6 21:35 lost+found
沒有問題,掛載成功。
(三)卸載加密硬磁盤
既然掛載加密磁盤有專用的命令,那么卸載加密磁盤也一定有專用的命令:
veracrypt -d /mnt
如果要卸載系統中掛載的全部veracrypt加密磁盤,則使用:
veracrypt -d
不指定掛載目錄即可。 再次查看系統中已經掛載的磁盤:
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 47G 1001M 43G 3% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/sda1 976M 80M 845M 9% /boot
veracrypt加密磁盤已經被卸載掉了。