Install Raspbian Buster Lite Headless ( setup Wi-Fi and activate ssh without access to the command line or using the network cable) on any Raspberry Pi

Dani Dudas
Jul 13, 2017 · 6 min read

For the newer version of Raspberry OS check this new post:

UPDATED March 2020 to work with the new version of Raspbian Buster.

If you have a Raspberry Pi Zero W (like me), or another model and you can’t connect a keyboard and screen to it. And also the Pi Zero W doesn’t have an ethernet port. You will need to do the setup a bit different.

In this tutorial, I will follow all the steps to setup Raspbian Buster Lite on your Raspberry Pi so in the end your Raspberry Pi will be connected to the Wi-Fi network and you can connect to it via SSH.

Image for post
Image for post

For this you will need:

  • Raspberry Pi (I have Raspberry Pi Zero W)
  • A micro SD card — Here we will install the Raspbian Buster Lite
  • Another computer to set up the image, wi-fi password and ssh access. (I use a Mac Book, so if you are on a Windows, probably some steps may change, but it should be something similar)

First of all, go to Download Raspbian from the official raspberry pi website. I will use the non-desktop lite version because I only need access to the command line. I don’t need the user interface.

The easier method to install on the SD card is using Etcher (balenaEtcher). So I will use this method in this tutorial.

  • Go here to download balenaEtcher and install it. It’s available for Mac, Linux or Windows. So you should be covered. If you have an old version on Mac Catalina make sure you update balenaEtcher first.
  • Connect the SD card to your PC
  • Open balenaEtcher and choose the image file (.zip) that you just downloaded (The filename is something like this: 2020–02–
  • Select the SD card you want to write to.
  • And click “Flash!”.
Image for post
Image for post
  • You will see the progress where the Flash! button is located on the image above.

Setup Wi-Fi without keyboard or network access

If you have Raspberry Pi Zero W like mine probably you will need to use some adaptors to connect a USB Keyboard and a HDMI Screen, but in case you don’t have those adaptors or you don’t have a USB Keyboard or Screen you can set-up to connect to your local Wi-Fi network from another computer and after that just pop-in the SD card and power-up the Raspberry Pi and it will automatically connect.

So to do this, after balenaEtcher completed to flash the Raspbian Stretch image to the SD card do the following:

  • First remove the card from the computer and insert it again
  • Detect the mount point of the SD card. If you use osx you can do that with this command
df -Hl
  • If you are on Windows check where the SD card is mounted.

In the root of the SD card create a new file named: wpa_supplicant.conf

cd /Volumes/boot
vim wpa_supplicant.conf
  • In the file you should add something like this:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
psk="Your Network's Passphrase"
  • country should be your country code. Change if you are outside of US
  • ssid is the name of the Wi-Fi network.
  • psk is the password of your Wi-Fi Network
  • key_mgmt usually it’s WPA-PSK, can have other values like WPA-EAP, but you should be ok with WPA-PSK in most cases.

After you finish this steps your Raspberry Pi will automatically connect to your Wi-Fi when you pop-in your SD card and power-up.

Setup SSH Access

But the problem is that you still can’t access the Raspberry Pi. You will also need to setup SSH access so you can connect to your Raspberry Pi from other computers from the same network.

You will need to have your SD card connected to your computer again and this is a really simple step

  • Create an empty file in the root of the SD card named ssh (without dot or extension).
cd /Volumes/boot
touch ssh

This will enable ssh on your Raspberry Pi so you will be able to connect next time you plug in the Raspberry Pi.

After that I put the SD card into my Raspberry Pi Zero W and plug in the Power cable (the one named PWR) and wait a little bit so the raspberry boot and connect automatically to Wi-Fi.

Connect via SSH

  • Find the IP Address of your Raspberry Pi.
Image for post
Image for post

In order to connect via SSH to your Raspberry Pi you will need to know the local IP of the Raspberry.

If you have Google WiFi it’s a bit easier.

Just open the app and go to Devices and search for raspberrypi. Select and go to Details to get the IP address.

You can also reserve the IP address so next time you restart the raspberry pi you will have the same IP address and you don’t have to search again the ip address.

Image for post
Image for post

Else go to your router settings. Usually this is or something like that. If you don’t know check on your router to find the IP address, username and password. After you successfully connect to your router go to Connected Devices and you will see something like raspberrypi.

Now you have the local IP address of your Raspberry Pi.

Open a Terminal window a type:

ssh pi@

pi is the default username on your Raspberry Pi. You will use this for the first time, after that you can change if you want to.

Also make sure you will use the IP address that you just found on the step before.

It will ask you: “Are you sure you want to continue connecting (yes/no)?”. Type yes and hit Enter

Image for post
Image for post

After that it will ask for the password. The default password is: raspberry

If you are connected you should see the prompt like this.

Image for post
Image for post

Change the default password

As you can imagine all the raspberries have the same username and password by default. You should change your default password right at the beginning with a more secure one. This is a very simple step.

  • Just type passwd after you connect to your raspberry using the pi username
  • Type the current password: raspberry
  • And type the new password two times
Image for post
Image for post

Next time you will connect to your Raspberry Pi, you will need to use this new password.

Update packages

To be sure that you have the latest packages with all the security fixes up to date you should run:

  • sudo apt-get update — To update the list of available packages and last version of each package
  • sudo apt-get upgrade — To upgrade the packages to the latest version. Probably the prompt will ask you to confirm. Type Y and hit enter.

That’s it. Now you should have a Raspberry Pi Zero W connected to your local network, accessible via SSH from other computers and with the latest version of packages.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store