• Skip to main content

Santiago Garza

Software Engineer

  • Blog
  • Photos
  • Contact
  • Tools
    • Text To Image AI

How to Set Up a Headless Raspberry Pi

April 27, 2021 by Santiago Leave a Comment

This tutorial illustrates how to configure and remotely connect to a raspberry pi without having to attach it to a monitor also known as “headless” setup.

Raspberry Pi Circuit Board
Photo by Harrison Broadbent on Unsplash

Required Hardware

  • Raspberry Pi 2 or later models.
  • Micro USB power supply.
  • Micro SD card.
  • Separate Computer or Laptop – used to configure and remotely connect to pi.
  • SD card USB adapter (only if your computer does not include a built in SD card reader).

Step 1: Install Raspberry Pi OS

First you’ll want to install the Raspberry Pi OS onto your Micro SD card using the Raspberry Pi Imager. Once you have the Imager software installed and running on your computer select Raspberry Pi OS Lite as your operating system (we won’t need the full desktop software for a headless pi), select your SD card, and click “Write”.

Screenshot of preferred Raspberry Pi Imager settings.
Screenshot of preferred Imager Software Settings for a headless raspberry pi

When the install is complete, eject the SD card and insert it in your computer one more time before proceeding to the next step.

Step 2: Setup WiFi Config File

If you plan on connecting to the network with an ethernet cable you can skip this step. However, if you want to connect to your raspberry pi over WiFi you’ll need to create a file called wpa_supplicant.conf and add it to the root folder of the SD card.

Copy the following text into the wpa_supplicant.conf file and replace the country, ssid, and psk variables with the corresponding settings for your wireless network.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=<Insert 2 letter ISO 3166-1 country code here>

network={
 ssid="<Name of your wireless LAN>"
 psk="<Password for your wireless LAN>"
}

The next time your raspberry pi boots up it will copy the contents of this file into the OS’s filesystem and will automatically connect to the wifi.

Step 3: Enable SSH

By default raspberry pi OS disables SSH access unless you manually enable it. This time you’ll create an empty file called ssh on the root folder of the SD card. That’s it, no file extension or configuration content needed. The next time the pi boots up it will check if this file exists, enable SSH, and then will delete the file. If you disable SSH again for any reason you can repeat this process to enable it again.

Step 4: Log in & Change the Default Password

The Raspberry Pi OS creates a default user with the username and password pi & raspberry, respectively. It’s recommended you change the default password the first time you log in in order to protect your pi from unwanted access.

Enter the following command into your terminal to SSH into the raspberry pi, replacing <pi.ip.address> with the IP address assigned to your device.

ssh pi@<pi.ip.address>

To easily find the IP address of your raspberry pi you can run a network scan using a free scanning tool such as fing.

Example of a Successful SSH connection.

Next we’ll proceed to change the default password to a more secure and unique one with the passwd command.

Thats it! You are now all set to remotely connect to your headless raspberry pi.

Related

Filed Under: Raspberry Pi, Tech Tips, Tutorials

About Santiago

I am a Professional Software Engineer with over a decade of experience. I have a passion for exploring how different technologies can enhance our everyday lives and enjoy sharing this knowledge with others. Learn more about me, or get in touch through my contact form.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • GitHub
  • WordPress
  • Twitter
  • Instagram
  • LinkedIn

Copyright © 2025 ยท Santiago Garza

 

Loading Comments...