Configure Headless Raspberry Pi for Wifi and SSH

Feb 16, 2019

System Administration Tutorial

By: Brandon Quakkelaar

Raspberry Pis are great little computers. Wonderful for running hobby services. But, whenever I start a new RPi project, I dislike needing to dig out my spare HDMI monitor and USB keyboard. I don’t like having to take up room and connect all that hardware to just enable SSH and Wifi which renders all that equipment unnecessary.

Recently I learned how to flash a new micro SD card and configure it to connect to my Wifi network and enable SSH before even turning on the RPi for the first time.

Prerequisites

Steps

  1. Download Raspbian Lite. This version is stripped down and doesn’t include things like a graphical desktop.
    • Save the zip file to disk, and unzip. You should see the image file.
  2. Flash the Micro SD card with Raspbian Lite. I used Etcher.
  3. Enable SSH by saving an empty file called ssh to the new boot partition on the SD card.
  4. Now this is the magic ingredient. Add a configuration file containing your Wifi information to the boot partition so that raspbian can connect on startup.

At this point, if you’ve followed the previous steps correctly, you can eject the SD card from your reader and place it in you RPi and plug it in.

After waiting a minute or two for the RPi to boot (for the first time) you can log into your router and you will be able to find it in the list of connected devices. That list should have the IP address shown so you can use it to SSH into it.

Execute ssh {IpAddress} -l pi and use the password raspberry to login.

Now that we’ve got a functioning Raspberry Pi, let’s do something useful with it.