This page describes how to create a bootable DVD that you can use to create a "persistent" Kali flash drive (a "Kali Live USB drive with persistence") that will save your files and configuration settings across reboots.
There are two phases:
- Create the bootable DVD.
- Use the DVD to create a persistent Kali USB drive. (Show only #2 for printing)
Create the bootable DVD
The bootable DVD is a re-mastered copy of System Rescue CD. You can find information about mastering a custom System Rescue CD here: How to personalize SystemRescueCd
The ext4-formatted partition used for mastering the DVD in this example is /dev/sda7
on a Linux machine. The lsblk
command can help you determine which partition to mount. If your computer is a Windows machine you can master your DVD on a ext4-formatted USB flash drive.
Create a System Rescue CD. (Download the .iso file and burn it to a CD-R disk.)
Boot the System Rescue CD. Use the default keymap when prompted.
Mount the ext4-formatted partition (/dev/sda7
in this example) on /mnt/custom
.
mount /dev/sda7 /mnt/custom
Expand the squashfs filesystem image.
sysresccd-custom extract
Add the Kali .iso image and shasums to /mnt/custom/customcd/files/root
cp /path/to/the/file /mnt/custom/customcd/files/root
Create the squashfs image.
sysresccd-custom squashfs
Create the ISO image.
sysresccd-custom isogen kalicreator
Reboot and burn the .iso file to a recordable DVD.
reboot
<Burn the .iso file using your computer's installed OS.>
Create the Persistent Kali USB Drive
(Show only this section for printing)
Note: Data on the USB drive will be lost.
Here's a preview of the steps:
- Boot from the DVD.
- Determine which device is your flash drive.
- Write the ISO disk image to the flash drive.
- Add persistence to the drive.
- Use the GNU Partition Editor (GParted) to create, format, and label the ext3-formatted partition.
- Mount the partition and write the configuration file.
- Shut down.
Step 1: Boot from the DVD.
During startup you'll be prompted for a keymap. Accept the default.
Step 2: Determine which device is your flash drive.
Be certain the device you're writing is the correct one.
<remove the USB drive if it's inserted> <insert the drive>dmesg | tail
lsblk
You can also try watch lsblk
and then
<insert the USB drive> wait <remove the drive> wait repeat until you are certain which device is the USB drive
Use Ctrl-C to exit.
The examples show this device ==> /dev/sdX
Substitute your drive's device.
Step 3: Write the ISO
Write the ISO disk image to the flash drive.
ddrescue kali-linux-2017.1-am64.iso /dev/sdX --force
or
dd if=kali-linux-2017.1-am64.iso of=/dev/sdX bs=512M status=progress
(It will take a while to write the 2.7 GB image, so be patient.)
Now you have a bootable Kali flash drive (without persistence).
Step 4: Add Persistence
Next you can add persistence to the drive by creating a third primary partition. (Two were created by the previous step.) The new partition will be ext3-formatted and have these characteristics:
- It will be labeled "persistence".
- There will be a text file named "persistence.conf" on it that contains a single line of text.
Start X.
startx
Use the terminal window to start the GNU Partition Editor.
gparted
Create the ext3-formatted partition
Select the device. (GParted -> Devices -> /dev/sdX) Select the unallocated space. Partition -> New
The new partition will have these attributes:
Free space following (MB): 512 Filesystem: ext3 Label: persistence Add
Apply your changes.
Edit -> Apply All Operations
Exit GNU Partition Editor.
GParted -> Quit
Mount the partition. We're doing this so we can write the tiny persistence.conf
configuration file.
mkdir /mnt/usb
mount /dev/sdX3 /mnt/usb
Add the text file.
echo "/ union" > /mnt/usb/persistence.conf
Verify the configuration file has been written.
cat /mnt/usb/persistence.conf
Your persistent Kali flash disk has been created.
Step 5: Shut Down
You can shut down from the GUI or use the command line.
shutdown -h now
First Boot Task
Boot from your drive and select "Live USB Persistence". Your first boot into Kali should be disconnected from a network so you can change the default password before connecting.
Change the Password
Persistent Kali ordinarily reverts the password using a configuration file that runs at boot time. This behavior can be modified by commenting out a line of text.
First, set the root password.
passwd root
Next, edit the configuration file that sets the password during boot. Comment out the line that sets the password by putting a #
at the beginning of the line.
leafpad /lib/live/config/0031-root-password
usermod [...]
becomes
#usermod [...]
Enjoy.