Headless Pi Zero Setup with Raspberry Pi Imager, Wi-Fi and SSH

A Raspberry Pi Zero has a mini HDMI port and a single micro USB data port, so connecting a monitor, keyboard and mouse needs two adapters and a USB hub. For most Zero projects that is unnecessary. A headless setup means the Pi boots straight onto your Wi-Fi with SSH enabled, and you control it from your laptop terminal from the very first boot.

In this tutorial you will flash Raspberry Pi OS Lite (Bookworm) with Raspberry Pi Imager, preconfigure the hostname, user account, Wi-Fi and SSH, find the board on your network, log in and do the first essential updates. The same steps work for the Zero W and Zero 2 W.

What You Need

ItemNotes
Raspberry Pi Zero W or Zero 2 WThe original Zero has no Wi-Fi; use USB gadget mode for it instead
microSD card, 16 GB or moreA branded Class 10 / A1 card boots faster and lasts longer
SD card readerUSB or built into the laptop
5 V micro USB power supplyPlug into the port marked PWR IN
Laptop with Raspberry Pi ImagerAvailable for Windows, macOS and Linux
2.4 GHz Wi-Fi networkName (SSID) and password; the Zero cannot use 5 GHz

Since the Bookworm release, Raspberry Pi OS no longer has a default pi user with the password raspberry. You must create a user during imaging. That is the main reason the old trick of dropping an empty ssh file onto the boot partition is no longer enough on its own.

Flashing the Card with Preconfigured Settings

  1. Open Raspberry Pi Imager and click Choose Device. Select Raspberry Pi Zero 2 W, or Raspberry Pi Zero for the Zero and Zero W.
  2. Click Choose OS, open Raspberry Pi OS (other) and pick Raspberry Pi OS Lite (32-bit) for a Zero W, or the 32-bit or 64-bit Lite image for a Zero 2 W.
  3. Click Choose Storage and select your microSD card. Double-check it is not your external hard disk.
  4. Click Next. When asked whether to apply OS customisation settings, choose Edit Settings.
  5. On the General tab, set a hostname such as pizero, a username and a strong password, your Wi-Fi SSID and password, the wireless LAN country (IN for India) and your time zone.
  6. On the Services tab, tick Enable SSH and choose password authentication, or paste your public key for key-based login.
  7. Save, confirm, and let Imager write and verify the card. Eject it safely.

Imager stores these choices in a first-boot script on the boot partition. On first power-up the Pi resizes the filesystem, creates your user, writes the Wi-Fi connection into NetworkManager and enables the SSH server, then reboots. The first boot of a Zero can take two or three minutes, so wait until the green activity LED settles down.

Finding the Pi and Logging In

Raspberry Pi OS runs the Avahi mDNS service, so on most home networks you can reach the board by its hostname followed by .local. Windows 10 and 11, macOS and most Linux desktops resolve .local names. If that fails, look up the IP address in your router's list of connected devices, or scan your subnet.

Run on your laptop: find the Pi and connect over SSH
# Check the Pi answers on the network (replace pizero with your hostname)
ping pizero.local

# Log in with the username you created in Imager
ssh student@pizero.local

# Alternative: scan the local subnet for the Pi (Linux/macOS, needs nmap)
# Adjust 192.168.1.0/24 to match your network
sudo nmap -sn 192.168.1.0/24

# Optional: create an SSH key on the laptop and copy it to the Pi
ssh-keygen -t ed25519
ssh-copy-id student@pizero.local

The first time you connect, SSH asks you to confirm the host key fingerprint. Type yes. If you later reflash the card with the same hostname, SSH will warn that the host key has changed; remove the old entry with ssh-keygen -R pizero.local and connect again.

First Steps After Logging In

Before starting a project, update the system and check that the network and storage are as expected. On a Zero W the full upgrade can take a while because the single core has to unpack every package.

Run on the Pi: update, inspect the network and add a second Wi-Fi network
# Update package lists and upgrade installed packages
sudo apt update
sudo apt full-upgrade -y

# Show the Wi-Fi connection NetworkManager created from your Imager settings
nmcli connection show
nmcli device status

# Show the IP address of the wireless interface
ip -4 addr show wlan0

# Add another network, for example your phone hotspot (prompts for password)
sudo nmcli --ask device wifi connect "MyHotspot"

# Check the root filesystem was expanded to fill the card
df -h /

# Open the configuration tool (interfaces, locale, boot options)
sudo raspi-config

Bookworm manages networking with NetworkManager, not the older wpa_supplicant.conf file and dhcpcd. Tutorials that tell you to edit /etc/wpa_supplicant/wpa_supplicant.conf or /etc/dhcpcd.conf are written for Bullseye and earlier. Use nmcli or sudo nmtui (a text menu) instead. The boot configuration files have also moved: config.txt and cmdline.txt now live in /boot/firmware/.

Adding a phone hotspot as a second network is a useful habit. When you take the Zero to a lab or a project demo where you do not know the Wi-Fi password, you can switch on your hotspot and the Pi will join it automatically.

Troubleshooting a Pi That Does Not Appear

  • No activity LED at all: the card is not flashed correctly, or power is in the wrong port. Reflash and use the PWR IN port.
  • LED flashes but never joins Wi-Fi: check the SSID and password for typing errors, confirm the network is 2.4 GHz, and confirm the country code was set.
  • ping pizero.local fails but the router shows the device: mDNS is blocked on some college and office networks. Use the IP address directly.
  • SSH says connection refused: SSH was not enabled in Imager. Reflash with the Services tab set, or attach a screen once and run sudo raspi-config to enable it.
  • Permission denied on login: the username is case-sensitive and was set by you in Imager; there is no default pi user.
  • Random disconnects: a weak power supply causes brownouts. Run vcgencmd get_throttled; any value other than throttled=0x0 points to under-voltage or overheating at some point since boot.

Summary

Raspberry Pi Imager's customisation settings turn the first boot of a Pi Zero into a fully networked, SSH-ready machine without ever connecting a monitor. Remember three Bookworm details: you must create your own user, Wi-Fi is handled by NetworkManager through nmcli, and boot files are in /boot/firmware/. With a working SSH login you are ready for every other project in this series, from GPIO and sensors to web dashboards and USB gadgets.