Headless Wi-Fi & SSH Setup

This is the step that makes the Zero W genuinely useful for headless projects: getting it onto your Wi-Fi network and reachable over SSH without ever attaching a monitor or keyboard. The current, recommended way to do this is entirely through Raspberry Pi Imager, configured before you even write the microSD card.

Configuring Everything in Raspberry Pi Imager

After choosing your OS (Raspberry Pi OS Lite, as covered in the previous lesson) and your storage device in Raspberry Pi Imager, but before clicking "Write," open the advanced customisation options. You can reach this panel with the keyboard shortcut Ctrl+Shift+X, or by clicking the gear icon that appears in the bottom-right corner once you've selected an OS. Inside that panel you can configure, all in one step:

  • Hostname - the name your Pi will identify itself as on the network
  • Enable SSH - turns on the SSH server so you can connect remotely from the very first boot
  • Username and password - the login credentials for your Pi
  • Wi-Fi SSID, password, and country - so the Pi connects to your network automatically

Once you save these settings and write the image, your Zero W will connect to that Wi-Fi network and have SSH already enabled the very first time it boots - no monitor or keyboard ever required.

Connecting Once It's Booted

Insert the microSD card, power on the Zero W, and give it a minute or two to boot and join the network on first boot. Then you need to find its address:

  • Check your router's admin page for a list of connected devices - look for the hostname you set.
  • Or, if your computer supports mDNS/Bonjour name resolution, try connecting directly using the hostname you configured instead of an IP address.

Once you have an address or hostname, connect over SSH from a terminal:

ssh username@hostname.local

replacing username with the username you set in Imager, and hostname with the hostname you set (or substitute the Pi's IP address if .local resolution isn't available on your network). Accept the host key prompt the first time, enter your password, and you'll land at a shell prompt running directly on your Zero W.

This page's code and terminal commands are a preview, not something you can run right on this website - this server runs PHP, not the Zero W's own operating system. Run these commands from your own computer's terminal, connecting to your actual Zero W.

How It Used to Work (Legacy Method)

Before Raspberry Pi Imager had built-in customisation options, people set this up manually by editing the freshly-flashed microSD card's boot partition directly from a computer: creating an empty file named exactly ssh (no file extension, which tells the Pi to enable the SSH server on first boot), and a text file named wpa_supplicant.conf containing the Wi-Fi network name and password in a specific format. This manual method still works on many images today and is useful to understand as "what's actually happening under the hood," but it has been superseded by Raspberry Pi Imager's built-in customisation panel as the simpler, recommended path - use the Imager method above rather than doing this by hand.

Next steps: With your Zero W reachable over SSH, move on to your first physical project in GPIO Basics: Blinking an LED.