I decided to create this tutorial since I needed a place to store some of the commands needed when installing Kali/SSH/VNC/Alfa adapter on Raspberry Pi 4.
- Flashing Kali linux on MicroSD card
- Booting Kali Linux
- SSH Connection
- Updating / New credentials
- Setting up VNC
- Installing Alfa Network adapter (AWUS036ACH)
- Download Kali Linux image (ARM / Raspberry Pi) from:
https://www.kali.org/get-kali/#kali-arm
- Download and install Balena Etcher which is used to flash Kali image on to MicroSD card. You can get it here:
https://www.balena.io/etcher/
- Run Balena Etcher and select
"Flash from file"
- Find the Kali Linux image file downloaded in step 1 and select it as the file you want to flash
- Insert MicroSD car into your computer/reader
- In Balena Etcher proceed to
"Select target"
and check the sd-card you want to use - Once source and target are chosen select
"Flash!"
- Flashing could take couple of minutes depending on the speed of the MicroSD card
Once the flashing process is complete, you can remove the MicroSD card and insert it into your Raspberry Pi.
To confirm that the flashing and installation of Kali Linux was successful, I like to connect display and keyboard to the Raspberry Pi before booting up.
- Boot Raspberry Pi
- Wait for the installation to complete
- Once you see the login screen you can use these default credentials to login:
username: kali
password: kali
You can continue using Kali linux like this with dedicated display and peripherals, or continue this tutorial to see other ways to use it without them.
- Connect Raspberry Pi to your router using ethernet cable
- Find the local IP-address of your RPI in your routers dashboard ("network map" or something like that)
- Open terminal on your computer and type:
ssh kali@"YOUR_RPI_IPADDRESS
- Provide the default password
kali
Now you should have successfully established a SSH connection to Kali Linux running on your RPI.
One of the first things to do with a fresh linux install is to update it.
- Either by using GUI terminal or SSH connection run the following command:
sudo apt update
- Next run
sudo apt full-upgrade -y
- After installation is complete, reboot Kali using
sudo reboot now
Your Kali linux should now be up to date.
Changing the default credentials is next on our list. Kali linux uses default username/password combo kali / kali
for basic user access and root / toor
for root level access.
To change passwords:
sudo passwd root
- provide default root password
toor
- enter new password two times
- And you're done.
You can use this same procedure to change password for user kali
(sudo passwd kali
...).
With VNC (virtual network computing) protocol you can use your Kali linux GUI over the network remotely.
I found it best to run installation as root (sudo did not work for me)
-
Change user to root using su (switch user) command in terminal:
su root
-
Run:
apt-get update && apt-get isntall -y x11vnc
-
After installation is complete reboot Kali using:
reboot now
-
Next we edit /boot/config.txt file, run:
sudo nano /boot/config.txt
-
Locate the following rows and change the parameters as follows:
disable_overscan=1 framebuffer_width=1920 framebuffer_height=1080
Framebuffer defines the resolution for your VNC screen. Remember to remove # from the beginning of the row!
-
Press
Ctrl+X
to save the changes you've made -
Reboot system again
sudo reboot now
-
Create a password for your VNC connection using:
sudo x11vnc -storepasswd
and write it to file when prompted. -
To configure x11vnc run:
sudo x11vnc -ncache -auth guess -nap -forever -loop -repeat -rfbauth /root/.vnc/passwd -rfbport 5900
-
To have x11vnc start automatically when system starts up we need to first create new service for it. Create new file using:
sudo nano /etc/systemd/system/vnc.service
-
Add this into the file:
[Unit] Description = X11VNC pre-login After = multi-user.target [Service] Type = simple ExecStart = /usr/bin/x11vnc -nonc -display :0 -auth guess -nap -forever -loop -repeat -rfbauth /root/.vnc/passwd -rfbport 5900 [Install] WantedBy = multi-user.target
-
Activate the service using:
-
sudo systemctl daemon-reload
-
To make this service automatically start, run:
sudo systemctl enable vnc
-
And lastly we will reboot once more
sudo reboot now
I prefer using VNC Viewer -client on macOS for connecting to Kali linux. To connect using VNC with the client of choice you provide it with the IP-address of RPI, the port number 5900 we defined earlier and the password we set for the VNC.
I have Alfa 1200 ultra range AWUS036ACH network adapter that I use e.g. for wardrinwing etc. To install drivers for this specific adapter follow these instructions:
- To install dkms package run:
sudo apt-get install realtek-rtl88xxau-dkms
- Change directory to Desktop using:
cd Desktop
- To download drivers run:
sudo git clone https://github.com/aircrack-ng/rtl8812au.git
- Change directory to
rtl8812au
(the one we just downloaded) using:cd rtl8812au
- Once inside the correct directory tun:
sudo make
and after it has completed runsudo make install
- And as we've done before, reboot the system using:
sudo reboot now
The drivers should now be installed and you can start using the adapter.