This is for my project on setting up a headless-kali-pi.
My main source of inspiration, but I was having problems and needed headless.
This was built from a combination of info.
- A network
- Rasberry Pi and its contents like power supply
- SD micro
- Another linux system - I recomend a live OS if you have windows.
- Image program - you can use win32diskimager , ApplePiBaker or Etcher
- The kali-pi image or option 2
At this point I trust you can use one of the software to flash the kali-pi image to your SD micro.
Now to make headless. In another linux plug in the device and go to mount the bigger partion. You can do this using the GUI or commands. Here is a little guide for to mount through terminal if you want I prefer GUI
After mounting make sure to remember the files path and go to the terminal and type
cd /media/[device name here]/etc/network/
You will need to fill in the details [device name here]
necessary.
I have videos that have helped me throw this raspberry pi headless and kali linux headless. (Caution second one was not that great)
raspberry pi through USB, not tested on kali
Then type.
sudo chmod 766 interfaces
sudo nano interfaces
In the file copy and paste this and press ctrl-x, then y to save, followed by an enter.
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug usb0
iface usb0 inet dhcp
Now that you are out of that file next is to.
cd /media/[device name here]/etc/wpa_supplicant/
sudo chmod 766 wpa_supplicant.conf
sudo nano wpa_supplicant.conf
Copy and paste, but with changes to MyWiFiNetwork
to your wifi name and aVeryStrongPassword
to the password.
To exit out press ctrl-x, then y to save, followed by an enter.
country=AU
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="MyWiFiNetwork"
psk="aVeryStrongPassword"
key_mgmt=WPA-PSK
}
Ok mount the smaller partion In the main dir create a file named ssh.
cd /media/[device partion 2 name here]
echo "" > ssh
This if for incase you ever want to boot up the device with a screen. video
cd /media/[device name here]/etc/lightdm/
sudo nano lightdm.conf
Comments would be with the '#'
Remove comment
autologin-user=root
autologin-user-timeout=0
Save and exit out of nano
- Press
Ctrl + X
- Press
Y
for yes to Save - Press
Enter
to keep the current name
cd /media/[device name here]/etc/pam.d/
sudo nano lightdm-autologin
Comment if exsists
auth required pam_if.so user != root quiet_success
Save and exit out of nano
- Press
Ctrl + X
- Press
Y
for yes to Save - Press
Enter
to keep the current name
You can now unmount and remove the SD out of the linux system to now plug it in to the Raspberry pi. If everything is done right, you are ready to boot your Raspberry pi for the first time. :)
The idea here is to connect to the Raspberry pi through SSH. On boot up you should see the Raspberry pi on you network.
There are a lot of diffrent ways to see it on your network. I recommend using an app on your phone called fing android or iphone or windows pc
There after scanning you will see a list of IP's Grab the numbers of the one under Raspberry Pi. It should look like ###.###.###.###
(On Mac or linux terminal) ssh root@[IP goes here]
(On Windows) Download and install Putty
- Ip or host is the one you just grabbed.
- user is root
- password is toor
If you need help this is not exact but should be a good example
When in congrats you are now headless.
You can take it a step further
In the SSH terminal
apt-get install x11vnc
x11vnc -storepasswd
enter password you want
To run it
x11vnc -usepw -reopen -bg -forever &
If the you are having problems like screen size fix or start up, etc..
Personal prefrence to have an on screen keybord (Can ignore)
sudo apt-get install matchbox-keyboard
You will need to expand the space
apt-get install gparted
gparted
Now use the gparted GUI to resize and comit the changes to the partition.
Then
apt-get update && apt-get upgrade
Personal prefrence, Webmin is a web-based system configuration tool for Unix-like systems.
I installed the older version, then upgraded. video
wget https://sourceforge.net/projects/webadmin/files/webmin/1.870/webmin-1.870.tar.gz
gunzip webmin-1.870.tar.gz
tar xf webmin-1.870.tar
cd webmin-1.870
./setup.sh /usr/local/webmin
You will be asked to answer some questions.
Just hit the enter button until you find the question about what operating system.
Put #45 for Debian and 9 for when asked what version.
After that fill the port 10000, username and password.
SSL put y for yes.
Start when boot put y.
Now you can go to http://localhost:10000
change all users passwords.
This is for the current user
passwd
That is for the Pi user
passwd pi