Relação Ametódica

Data Science, Machine Learning, Artificial Intelligence, Visualization, and Complex Systems.

Raspberry Pi Tip: Headless with ssh and Wifi enabled

This tip is mainly for my own reference during future installations, but it might be helpful to anyone trying to setup a headless Raspberry Pi.

After creating the SD Card with your Raspberry Pi OS don’t rush to try it out. Add two files to its root folder: ssh and wpa_supplicant.conf

ssh

The existence of the ssh file in the boot folder will instruct Raspberry Pi to enable SSH and delete the ssh file. This file can be an empty file or with any random text in it. It doesn’t matter.

wpa_suplicant.conf

The wpa_spulicant.conf file enables wifi (if you have a wifi dongle connected to the Pi).

The contents of the file matter as they contain the passwords and wifi networks that you want to connect to. Here’s an example:

country=PT
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="network1"
scan_ssid=1
psk="passoword_for_network1"
key_mgmt=WPA-PSK
}

If you want to configure multiple networks you can add more network blocks.

find the Raspberry Pi IP in the local network

It remains to find the Raspberry Pi address. I just nmap the local network with

sudo nmap -sS -p 22 192.168.0.0/24