Making a Kali Bootable USB Drive with persistence on OSX

I am a fan of Live USBs

A LiveUSB gives me the opportunity to play and test out a Linux distro without making any changes to my computer. Unknown to many, there is a data persistency mode in the Live session where you can make changes and save files to your USB drive and the data will persist even after shutting down the live session.

Though a Live USB is non-destructive (i.e does not make any changes to the hard drive) and it’s very portable (allows me to run the Live USB operating system on any available system), I observed there are some security issues as well. The Live USB does not have any security mechanism to protect anyone from accessing your data. Also the Live USB will be comparability slow in boot up. The Live USB would have to run a series of compatibility tests to ensure that everything would work fine on a machine.

Kali Linux does allow Live USB and with a few steps we can add persistence to our setup.

The high level steps are

1. Download Kali ISO

2. Format and create partitions on the USB.

3. Copy the KALI iso in Live USB mode to the USB

4. Create/configure a persistence partition.

5. Mount the persistence partition.

Details steps are provided below

Step 1. Download the latest Kali Linux iso.

Step 2. Open Disk Utility and format the USB to FAT32

Step 3. Create partitions on your USB

1st partition

Label – KALI

Format – FAT32

Size – 4 GB

2nd partition

Label – persistence

Format – FAT32

Size – 15 GB.

Updating and upgrading Kali will fill up this partition pretty fast, so I have kept 15 GB

3rd partition (this is optional. I like to transfer files using the pen drive to other machines. If you don’t want this, you may use the entire space in 2nd partition)

Label – MyData

Format – FAT32

Size – rest of the drive

NewImage Step 4. Note down the device name of the KALI partition. In this example, the device name is disk2s2 NewImage Step 5.  Download and launch UNetbootin

Select the radio button for Diskimage

Supply it with the ISO image of Kali

In type, select USB Drive.

In drive, select the same device which we had observed in the previous step (in this example disk2s2)

Click on OK button

NewImage

UNetbootin will do its work.

NewImage

After some time, UNetbootin will notify Installation Complete

Click on Exit button

NewImage

Step 6. Restart your Mac and keep the option key pressed. Select EFI Boot

Step 7. In the Kali boot menu, select Live system (persistence, check kali.org/prst) and press Enter key

Now we need to change the file system type of persistence to ext4

Step 8. Launch GParted

Step 9. Select the partition  with label PERSISTENCE

Step 10 .Right Click and click on Unmount

Step 11. Right click on persistence and click on delete

2019 09 29 18 28

Step 12. Apply Pending Operations.

Now we will see that the partition has become unallocated

NewImage

Step 13. Right click on unallocated partition and click on New

Set the following

Create –  “Primary Partition

File system – ext4

Label – persistence

Step 14. Click on Add button

Step 15. Apply pending operations

NewImage

Step 16. Exit GParted

Step 17. Launch terminal and type the following command to see the disks/volumes

fdisk -l

NewImage

We can see our persistence partition device is /dev/sdb3

This might be different for you. Please make a note of this

Step 18. In terminal, enter the following command and press the enter key

mkdir -p /mnt/myusb

Step 19. In terminal, enter the following command and press the enter key. Replace <<persistence partition>> with your device

mount <<persistence partition>> /mnt/myusb/

In this example it is

mount /dev/sdb3 /mnt/myusb/

Step 20. In terminal enter the following command and press the enter key

echo "/ union" > /mnt/myusb/persistence.conf

Step 21. In terminal enter the following command and press the enter key

umount <<device>>

In this example it is

umount /dev/sdb3

Step 22. Now we can open persistence.conf using Files. We should see the text / union.

Step 23. Reboot Kali Linux

We now have persistence on the Kali Linux Live USB

Be the first to comment

Leave a Reply

Your email address will not be published.


*