Portable Hackbox: Kali Linux on a Raspberry Pi 4

Rajiv Manivannan
3 min readApr 13, 2018

--

It’s my long time wish to have a portable hack box. While surfing the internet I came across a blog about the Kali Linux for Raspberry Pi. Here I am sharing my experience how I build one.

Procure the following two things. Raspberry Pi 4 board and 32 GB Class 10 micro SD card. For the initial setup, monitor with HDMI connector and keyboard mouse are required.

Download the Kali Linux ARM image for Raspberry Pi foundation from here.

Flash the downloaded image on the SD card. I am using a command line tool called Flash to write the image in the SD card.

Now, connect the peripherals with Raspberry Pi and provide power and internet connection to the device. After the boot complete login with default user name kali and password kali.

Run the following commands to fetch the GnuPG key to update and upgrade the packages.

$ apt-key adv --keyserver hkp://keys.gnupg.net:80 --recv-key 7D8D0BF6$ apt-get update$ apt-get dist-upgrade

Install GParted and resize the disk space by running the following command.

$ apt-get install gparted$ gparted

The gparted command will open a GUI interface. In that, resize the disk space and reboot once.

Install and enable the SSH for the Remote communication.

$ apt-get install ssh$ systemctl enable ssh$ service ssh start$ vi /etc/ssh/sshd_configMake the following changesFrom:#PermitRootLogin prohibit-passwordTo:PermitRootLogin yes$ service ssh restart

To enable the Auto-login

$ vi etc/lightdm/lightdm.confMake the following changesFrom:#autologin-user=#autologin-user-timeout=0To:autologin-user=kaliautologin-user-timeout=0

Install the VNC Server for Remote desktop

$ apt-get update
$ apt-get -y install tigervnc-common tigervnc-standalone-server
$ apt-get -y install autocutsel

Create a session password for the VNC using the below command

$ vncpasswd

Create systemd unit file and save.

$ vi /etc/systemd/system/vncserver.serviceAdd the following config and save.[Unit]
Description=VNC remote desktop server
After=sshd.service
[Service]
Type=dbus
ExecStart=/usr/bin/vncserver -localhost no
User=root
Type=forking
[Install]
WantedBy=multi-user.target

Provide file owner permission and enable VNC

$ sudo chown kali:kali /etc/systemd/system/vncserver.service
$ sudo chmod 644 /etc/systemd/system/vncserver.service
$ sudo systemctl start vncserver
$ sudo systemctl enable vncserver

To verify the VNC Server running status

$ sudo systemctl status vncserver
vncserver -list

To access from another machine install the corresponding VNC client from here.If both the devices are connected in the same network.You can connect by providing the host IP and Password.

Remote host: xx.xx.xx.xx:5901
Password: (password given while setting up VNC server above)

To Install all the Kali Linux Tools

$ apt-get install kali-linux-full

Important: Change the default password of the Kali Linux.

root@kali:~# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

You can create a WiFi hotspot connection from your mobile phone and configure with your Raspberry Pi. So that, you no need to carry any peripherals with you. You can make remote communication from your mobile phone using VNC Viewer App Android / iOS.

Your portable Hack box is ready!

--

--