Adding SSH & WiFi to a headless Raspberry Pi without hooking up a monitor or keyboard!

Background: I’ve been hunting for a few days on a true way to add SSH and a wireless connection to a true headless machine (no monitor, keyboard, or mouse). I have Raspberry Pi 3 in a spare room with no monitor, but it’s connected to my printer and I don’t want to bring my spare TV in there. In short, I was able to do it this evening! With a new image of Raspbian burned using Etcher (no, it’s not command line… but I’m all about ease of it) I got it working.


After your image is burned to your SD card you should be able to mount it (if it auto-unmounted) and have a “boot” image mounted. On my Mac, it simply shows up as /boot/. Open that up and it should look similar to this screenshot (not mine, I failed to get one of my own), it won’t look like this, but close-

We’re going to be adding two files to this list. One will give us SSH and one will give us WiFi, straight out the gate!


First, the Raspberry Pi Foundation page on SSH states:

For headless setup, SSH can be enabled by placing a file named ‘ssh’, without any extension, onto the boot partition of the SD card.

Now I don’t know if it really makes a difference, but I tried to make a “file” named “ssh” the first time and it didn’t work for me. However, I did get it to work the second time with a few changes (I’ll explain in a min).

For now, we need to make two files in our newly created /boot/ image. I recommend just opening up your favorite text editor and saving as ssh.txt (or whatever extension you want) file. We’re going to get rid of that extension anyway. The next file you’ll make, also with that text editor, is one named wpa_supplicant.conf (.conf is the file extension here).

Next, we open up terminal and make your way to the /boot/ volume (on your own computer, not the Pi)

$ cd /Volumes/boot/

This will get you into the neighborhood of your burned boot image. If in doubt, you could just use

$ cd ../

A few times will get to as far back as you can in your directory, eventually, you’ll come to this in your terminal

As noted above go into your “Volumes” director and /boot/ will be in there. Once in your /boot/ volume type

$ ls

Now we’re back to the first screenshot(ish), yours will look different, only now you will also have the two files you made earlier just sitting there waiting.

Again, using terminal type

$ sudo nano ssh.txt

It should ask you for your password, this is your Mac’s password. Now, you’ll recall that this was a blank text file, however, once you open it up with nano (again, I’m using a Mac) you see that it’s not really empty. I’m not sure if this next step makes any difference, but doing this worked for me, so I’m sharing.

Let’s clean this up so it’s really a “blank file.” Simply use your arrow keys to move to the bottom of the text and backspace it all gone. After that’s done hit Control+o (the control key and the letter o). This will let you edit the name and extension of the file, note below mine is .rtf, backspace until just the “ssh” is left.

With just ‘ssh’ left hit the enter/return key and “Y” for yes. Next, type Control+x to exit. You now have a blank “ssh” file in you /boot/ volume. At the prompt type

$ exit

This will close out your nano session and save it all to your /boot/ volume.

Next, let’s get some WiFi working.


You may have to close out your terminal session and open it back up. Once you’re back in, get to your /boot/ volume as we did above. Also, as we’ve already done, we’re going to nano into the .conf file we made earlier to get the WiFi data entered. While in your /boot/ volume type

$ sudo nano wpa_supplicant.conf

This will open up a nano session to edit this configuration file

You’ll most likely have to clean this file out and make it blank too. Once it’s done, it should look like mine does here to the left.

What we’re going to do now is add our WiFi credentials into this file so when your new image boot for the first time it’ll automatically take this newly created file and copy its details into the systems /ect/wpa_supplicant/wpa_supplicant.conf permeant file to auto-configure wireless network access. From the Raspberry Pi blog-

If a wpasupplicant.conf file is placed into the /boot/ directory, this will be moved to the /etc/wpasupplicant/ directory the next time the system is booted, overwriting the network settings; this allows a Wifi configuration to be preloaded onto a card from a Windows or other machine that can only see the boot partition.

— The latest update to Raspbian — Raspberry Pi

Let’s add the following to our blank .conf file

ssid="your ssid"
psk="your password"

Easy enough. For this, you WILL leave the double quotations and just enter the SSID of your router and your WiFi password. If you don’t have your SSID broadcasting you may wish to turn that on for a moment so you Pi can find the network. It’ll look something like this

Yes, it’s that easy! To save this press ctrl+x and y for yes and then enter. Then type this to close our your terminal session

$ exit

Done, your wpa_supplicant.conf will insert itself into your Pi as it’s booting up and you should have WiFi network access. BAM!

Go place that ‘lil SD card into your Raspberry Pi… no, really, go, I’ll wait. We’re not quite done yet.

As always, if this is a fresh install please be sure to CHANGE YOUR PASSWORD! The easiest way for the learning noob in all of us is to SSH in (’cause you should be able to do that now without issue.) First get your IP, if your network settings were correct just open your terminal and type

$ ping -c 1 raspberrypi.local

This will give you your IP address (that -c 1 tell the system to only ping your Pi once, otherwise it’ll just keep going.

Your output from the ping will look like this

With your address, you’ll SSH into your system via

$ ssh [email protected]

After entering the default password of raspberry you’ll type

$ sudo raspi-config

Second option down is there to change your password… DO IT!

And we’re done here. If you have any questions please let me know so I too can learn with you.

Be First to Comment

Leave a Reply