加密usb持久live制作(2020-03-24)

我的公众号上也有,bluepio。有兴趣可以关注一下

旧版的亲测行不通了,我自己做了一下。把教程分享给大家。

这些都是我在live模式下复制的命令。

开机

下载镜像和用rufus刻录我就不啰嗦了。

进入u盘启动

选定 encryted persistence

如果无法进入就断电重启

再次进入后调到 encryted persistence上按e

会进入一个文本,在quiet slash前输入nouveau.modeset=0·和两边的内容保持一个空格的距离。

ctrl+x就可进入系统

进去后打开个终端,输入sudo -i执行下面的命令

如果中途锁屏了,解锁密码是toor

先用sudo fdisk -l查一下你的u盘是/dev/sd?

打开parted

┌─[✗]─[user@parrot]─[~]
└──╼ $sudo parted
GNU Parted 3.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print devices                                                    
/dev/sda (128GB)
/dev/sdb (1000GB)
/dev/sdc (127GB)
(parted) select /dev/sdb                                                  
Using /dev/sdb
(parted) print /dev/sdb                                                        
Model: ATA HGST HTS541010B7 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                          Flags
 1      1049kB  17.8MB  16.8MB               Microsoft reserved partition  msftres
 2      17.8MB  947GB   947GB   ntfs         Basic data partition          msftdata
 3      947GB   1000GB  53.2GB  ext4

具体分区

(parted) select /dev/sdc                                                   
Using /dev/sdc

显示出的信息

(parted) print /dev/sdc                                                   
Model: SanDisk Extreme (scsi)
Disk /dev/sdc: 127GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      32.8kB  4169MB  4169MB  primary               boot, hidden
 2      4169MB  4170MB  754kB   primary

请用mkpart primary "开始节点" "结束节点" 来创建分区

建议用第二个分区的“结束节点+5MB”作为开始节点

结束节点参考你的u盘大小建议用sudo fdisk -l 查询一下,再把GB换算成MB

单位是MB,1GB=1024MB

(parted) mkpart primary 4175 81920                                        
(parted) quit            

encryted加密

加密你的分区。请注意/dev/sd"x"3.如果你不知道x是哪个,请用 sudo fidisk -l 查一下你的u盘是哪个。

┌─[✗]─[root@parrot]─[~]
└──╼ #cryptsetup --verbose --verify-passphrase luksFormat /dev/sdc3

WARNING!
========
This will overwrite data on /dev/sdc3 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter passphrase for /dev/sdc3: 
Verify passphrase: 
Key slot 0 created.
Command successful.

注意: 不是 yes, 是 YES.

现在你可以参考我的教程,不过别忘了 sd"x"

┌─[root@parrot]─[~]
└──╼ #cryptsetup luksOpen /dev/sdc3 my_usb
Enter passphrase for /dev/sdc3: 
┌─[root@parrot]─[~]
└──╼ #ls /dev/mapper/
control  my_usb   
┌─[root@parrot]─[~]
└──╼ #ls /dev/mapper/my_usb 
┌─[✗]─[root@parrot]─[~]
└──╼ #mkfs.ext4 /dev/mapper/my_usb 
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 18976512 4k blocks and 4751360 inodes
Filesystem UUID: 64f1f3cc-fe68-419b-a920-413f2b413dc2
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (131072 blocks): 
done
Writing superblocks and filesystem accounting information: done  ┌─[✗]─[root@parrot]─[~]
└──╼ #mkfs.ext4 /dev/mapper/my_usb 
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 18976512 4k blocks and 4751360 inodes
Filesystem UUID: 64f1f3cc-fe68-419b-a920-413f2b413dc2
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (131072 blocks): 
done
Writing superblocks and filesystem accounting information: done  
┌─[root@parrot]─[~]
└──╼ #e2label /dev/mapper/my_usb persistence
┌─[root@parrot]─[~]
└──╼ #mount /dev/mapper/my_usb /mnt/my_usb  
mount: /mnt/my_usb: mount point does not exist.
┌─[✗]─[root@parrot]─[~]
└──╼ #mount /dev/mapper/my_usb /mnt/my_usb
mount: /mnt/my_usb: mount point does not exist.
┌─[✗]─[root@parrot]─[~]
└──╼ #mkdir /mnt/my_usb
┌─[root@parrot]─[~]
└──╼ #mount /dev/mapper/my_usb /mnt/my_usb
┌─[root@parrot]─[~]
└──╼ #echo "/ union" > /mnt/my_usb/persistence.conf
┌─[root@parrot]─[~]
└──╼ #umount /dev/mapper/my_usb

好了,大功告成,可以重启了


服务器资源由ZeptoVM赞助

Partners Wiki IRC