From charlesreid1

KaliPi.jpg

This is a guide to connecting to a headless installation of Kali Linux on a Raspberry Pi. General info about running Kali on the Pi here: Kali Raspberry Pi

More info about all-things Kali Linux: Kali

A Note on Headless

Why did I write this article? Two reasons:

Reason Number One Reason Number Two
Adapter1.jpg Adapter2.jpg

I simply didn't have the luxury (or the hardware and adapters) to get this thing working. I had to get this headless Kali Linux Raspberry Pi working, without a screen, without a keyboard: literally, a black box.

The perfect puzzle.

Connecting to Kali Pi

Once you've got Kali on the Raspberry Pi, now what? Well, it's pretty easy: once you boot up the Raspberry Pi, it will have a static IP address. The one we picked will let us SSH into the Pi if we have a network cable plugged into our laptop.

That's right: one end of the network cable into the laptop, the other end into the Pi:

LaptopKaliPi.jpg

Download Correct Image Version

Check to make sure your Kali Pi image matches your Raspberry Pi version. Version B+ has two USB ports, and Version 2 has four USB ports. You can download your Raspberry Pi Kali image from the Offensive Security webpage: https://www.offensive-security.com/kali-linux-arm-images/

There are 3 Raspberry Pi images listed on that page. I downloaded the "Raspberry Pi" image kali-2.0.1-rpi.img and this worked on the Raspberry Pi B (older design, 2 USB ports). If you have a B+ (newer design, 4 USB ports), get the "Raspberry Pi 2" image.

Once you've downloaded the image. it will be named something like kali-2.0.1-rpi.img.xz. The xz extension means it is a compressed file, so decompress it with `tar xf kali-2.0.1-rpi.img.xf`.

You can use the resulting image file to flash the SD card that your Raspberry Pi will use.

Setting a Static IP

You'll want to set a static IP address for the Raspbery Pi before you boot. Assuming we're connecting the Pi directly to the laptop with a crossover cable, we'll use an IP address in the range 169.254.X.Y. The IP prefix 169.254, like the IP prefixes 192.168 or 10.X, is a special IP address for special networks. In this case, 169.254 is the "link-local address" - an IP address range for devices connected directly to the computer with a crossover cable. (Original source of this IP address was here, but a search for 169.254 will point you toward the "link-local address" Wikipedia page here).

My favorite IP address in this space happens to be 169.254.113.200.

You will add ip=169.254.113.200 to the end of the boot line, which is on the SD card's boot partition in cmdline.txt. When you're done, it should look something like this:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 elevator=deadline root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ip=169.254.113.200

For more details on this procedure, see RaspberryPi/Headless

For more details on how the SD card works, see Kali Raspberry Pi/Installing#How the Kali Linux Startup SD Card Works

Enabling SSH

I detailed a problem connecting to the Pi via SSH, which took me a long time to resolve. The issue was that I was powering the Pi through a mini USB hooked up to a computer, which was not providing the Pi with enough power to run the ethernet port 100% of the time (or most of the time). Plugging it into the wall socket resolved the issue with SSH connectivity.

The details are here: Kali Raspberry Pi/Headless SSH Problem

Good To Go

With these and the many other hints, tricks, and tips available online, I'm sure you'll be able to find your way $HOME on the headless Kali Linux Raspberry Pi.