How to install Kali Linux on a USB drive

TUTORIAL

This article is aimed at anyone who is approaching the world of cybersecurity and may be at the stage of wondering which operating system is best suited for security testing, for example vulnerability assessment or penetration testing. Let’s start from the assumption that every operating system is suitable for the purpose, but generally you need to spend some time configuring and installing the numerous tools necessary to carry out “white hacking” activities. For this reason my suggestion is to start from a distribution that’s already ready and in that case I can only recommend Kali Linux, already optimized and complete. Kali Linux, in fact, natively provides a complete suite of tools aimed at securing systems and activities of “ethical hacking”. Among the most important tools we mention those specialized in:

  • Information Gathering
  • Vulnerability Analysis
  • Exploitation Tools
  • Wireless Attacks
  • Stress Testing
  • Reverse Engineering
  • Hardware Hacking
  • Forensics Tools
  • Web Applications
  • Sniffing & Spoofing
  • Password Attacks
  • Maintaining Access
  • Reporting Tools

With Kali Linux you can immediately experiment and test the different programs that the distribution will make available; among the various possibilities you will be able to:

  • analyze vulnerabilities, databases, web applications
  • perform exploits, brute force, stress tests, port scanning, reversing, spoofing, etc.
  • find security flaws in wireless networks, wireless attacks,
  • obtain in-depth information about networks or computers and servers, software bugs

That said, the best way to appreciate the distribution is to try it. In any case, if you are undecided and don’t want to spend too much time preparing a definitive environment, the fastest way to get started with Kali Linux is to boot the “live” from a USB drive. This method undoubtedly has several advantages:

  • It is non-destructive to existing systems, so it does not make changes to the already functioning host system.
  • It is portable, so you can carry Kali Linux in your pocket on a USB stick and use it anywhere within minutes on an available system
  • It is customizable: you can, in fact, modify your Kali Linux ISO image and make it suitable for your needs
  • It is possible to configure the Kali Linux “live” USB drive so that it has persistent storage

At this point I would say not to waste any more time and move to practice by making a Kali Linux ISO bootable on a USB drive.

What we will need

First of all we must download from the official Kali Linux site a version of the latest ISO image available. If you are using Windows, to write the image to a USB drive you will also need to download the Win32 Disk Imager utility from launchpad.net  or from sourceforge.net. On Linux and OS X, it is instead possible to natively use the dd command. We will also need a USB stick of at least 4 GB. (Systems that have a direct SD card slot can substitute the USB stick)

Procedure for installing Kali Linux Live on a USB stick

As already mentioned the installation procedure can change depending on the operating system used and also depending on the mass storage writing software. In this article we will show the preparation procedure for the usb/micro sd device on Windows using win32 disk imager and on Linux and OS X via dd

Procedure for creating a USB drive on Windows

  1. Connect the USB drive to an available port on the Windows PC, indicate to the Win32 Disk Imager software the identifier of the USB device to write to (for example “F: ”).
  2. Choose the Kali Linux ISO file to write.
  3. Click the “Write” button.

 

 

Once the write is complete, safely eject the USB drive from the Windows computer. At this point you can use the USB device to boot Kali Linux.

Preparing a Bootable Kali USB Drive on Linux

Creating a bootable USB stick in a Linux environment is quite simple. After downloading and verifying your ISO file, you can write your USB stick using the following procedure. Remember that you must run the dd command as root or precede it with the sudo command to obtain the necessary permissions. Be careful which device you start the write process on because it is irreversible and you will lose all the data stored on the device. To do this I recommend first identifying the device, so initially run, in a terminal window, the command without the USB stick inserted.

sudo fdisk -l

You will get an output that will look more or less like this; it depends a lot on your system configuration and connected devices such as hard disks or others. In any case you will certainly find the identifier – “/dev/sda” – containing the partitions (/dev/sda1, /dev/sda2 …) if you have a standard configuration. In my case /dev/sdb also exists because I have two disks. This information is useful for the comparison later when we insert the USB stick.

At this point connect the USB stick to a free USB port and run the same command "sudo fdisk -l" a second time. The additional information we find compared to the first command will be what we need to proceed with the Kali Linux installation.

In this case we can say for certain that our 4GB USB stick is connected on device /dev/sdh1. Proceed with caution. Assuming the ISO file you downloaded is named “kali-linux-2019.3-amd64.iso” and is located in the /tmp directory. Run the following command:

dd if = /tmp/kali-linux-2019.3-amd64.iso of = /dev/sdh bs = 512k

Writing the image can take a long time, so be patient and since the dd command does not provide feedback do not interrupt the write. At the end of the process something like the following should appear:

5823+1 records in
5823+1 records out
3053371392 bytes (3.1 GB) copied, 746.211 s, 4.1 MB/s

Now you can use your USB stick to boot Kali Linux live.

Preparing a Bootable Kali USB Drive on OS X

The procedure for creating a bootable USB stick is not very different from Linux, if only because OS X is a UNIX-based system. Let’s review the steps to take. Again, I encourage you to be careful which device you start the write process on because it is irreversible and you will lose all data stored on the device if you choose the wrong device. We start as before by identifying the devices present on the computer. Initially run the following command without the USB drive inserted, in a terminal window.

diskutil list

A list of available devices will be displayed (similar to /dev/disk0, /dev/disk1, etc.), that is the list of disks mounted on the system, along with information about the partitions on each of the disks.

Connect the USB stick to the USB port of your Apple computer and run the diskutil list command a second time. The path of the USB drive will most likely be the last one in the list. In any case, it will not be present in the previous list.

In this example, you can see that /dev/disk2 is now present. Unmount the drive (assuming, for this example, that the USB stick is /dev/disk2) by running the command:

diskutil unmount /dev/disk2s1

Now proceed with caution. Assuming the ISO file you downloaded is named “kali-linux-2019.3-amd64.iso” and is located in the /tmp directory and that the USB device is /dev/disk2. Run the following command:

sudo dd if=/tmp/kali-linux-2019.3-amd64.iso of=/dev/disk2 bs=1m

Note: increasing the block size (bs) will speed up the write progress, but will also increase the chances of creating a defective USB stick. Using the chosen value on OS X produced working images.

Writing the image can take a long time, so be patient and since the dd command does not provide feedback do not interrupt it. At the end of the process something like the following should appear:

2897+1 records in
2897+1 records out
3037736960 bytes transferred in 21044.597244 secs (144348 bytes/sec)

It’s time to reboot your PC and use Kali Linux, make good use of it.

Se vuoi farmi qualche richiesta o contattarmi per un aiuto riempi il seguente form

    Comments