How to configure SSH & WiFi on a headless Raspberry Pi Zero W

Something that I struggled with in the past, configuring a headless Raspberry Pi so I can SSH into it over WiFi. It used to be a quite a hassle connecting a monitor with HDMI and a keyboard etc, but these days it's quite easy to do with the latest version of Raspbian.

Download & burn image to card

First things first, download the latest version of Raspbian (Lite) and burn it on your your Micro SD Card, a tool I often use for this is Etcher. Once that is done, remove the card from your computer and plug it back in afterwards so we can configure it.

Enable SSH

Since a few months (actually already over a year) Raspbian checks if there's an ssh file present on the /boot volume, if it is, it will configure Raspbian to boot with the SSH deamon on and remove the file.

So the only thing you really need to do is create an empty file called ssh on the boot volume. The easiest way this can be done is using terminal, changing to the correct location and the following command touch ssh. But of course you can use any file explorer for this as well.

Configure WiFi

The same thing exists for the WiFi configuration file. I only found out about this months after I discovered how to enable ssh. In any case, you can just create a file in the same location on the boot volume called wpa_supplicant.conf and add your WiFi networks in there. Raspbian will copy this to /etc/wpa_supplicant/wpa_supplicant.conf on first boot and delete it afterwards. Note that the Raspberry Pi Zero W only supports 2.4 Ghz WiFi networks.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

    ssid="Wouter's Place"

And that should be it! 🍻