Accessing a Headless Raspberry Pi

Its a bit of a departure from my usual area, but as the Raspberry Pi runs Debian, I agreed to help a friend get his Pi set up to run his robotic kit. However he arrived with the Pi Zero alone: no power and no monitor. How to get into it …?

So first of all we got the Rasbian image downloaded and transferred onto the micro SD card with dd, by following the instructions on the website. Luckily I had a USB to micro SD adapter handy. But then what? You can boot it up but with no screen or keyboard, you can't get it to connect to your network.

Well yes you can in fact. If you mount the SD card again on a computer, and find your way to /etc/wpa-supplicant/ you can edit the wpa-supplicant.conf there to connect to your wifi. It should look like this:

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

network={
	ssid="YourNetworkSSID"
	psk="YourPa$$word"
	key_mgmt=WPA-PSK
}

That should do it. I rebooted and ran nmap on the network until I saw another IP address pop up, and that was the Pi. But ssh wasn't running, although there were some funky ports showing around 64xxx to 65xxx.

Turns out that problem is also quite easy to solve. Whip the card out again and mount it in your computer and you'll see two partitions, one for root and one for boot. Go into the boot partition and create an empty file called ssh (eg touch ssh). When you reboot, the pi will be running ssh. Use the default login (pi / raspberry) to get access.

OK, nearly there. The next step is to run raspi-config. You can use this to verify that ssh is activated, and also activate VNC server, under the Interfaces section. You might want to change the password while you're in there too. So now you can connect to your Raspberry Pi via VNC and complete the setup.

Leave a Comment