Headless Raspberry Pi Setup

Contributors: Shawn Hymel
Favorited Favorite 19

Ethernet with Static IP Address

If you do not want to use the serial terminal or want to be able to log in to your Raspberry Pi over a network connection, you can give your Pi a static IP address, connect it to your network (or to your computer via a crossover/Ethernet cable), and log in via SSH.

Note: Windows and Mac cannot access the filesystem partition of the Raspberry Pi image on the SD card. As a result, you will need access to a computer with a Linux operating system. If you don't have a Linux computer nearby, you can make a Live CD (or bootable USB drive) to temporarily boot into Linux to make the necessary file changes on the SD card. Once you have edited the necessary files, you can switch to another operating system.

Set Up Static IP Address

Plug the micro SD card (with the flashed Raspbian image) into your Linux computer. Most modern versions of Linux should automatically mount both partitions (boot and rootfs). You will need superuser privileges to edit the files on rootfs. Open a command prompt and edit /etc/dhcpcd.conf in rootfs.

Navigate to the rootfs directory (wherever your Linux distro has mounted it):

cd /media/<USERNAME>/rootfs

Edit the dhcpcd.conf file:

sudo nano /etc/dhcpcd.conf

Scroll down to the bottom of the file and add the following lines:

interface eth0

static ip_address=
static routers=
static domain_name_servers=

Setting a static IP address on the Raspberry Pi rootfs partition

Save and exit by pressing ctrl + x and y when asked if you would like to save.

Enable SSH

In 2016, much of the Internet slowed to a crawl as a result of the IoT DDoS attack brought about by the Mirai botnet. In response to vulnerable IoT systems with default username and password logins, the Raspberry Pi Foundation decided to disable the SSH connection by default on all future releases of Raspbian. As a result, we now need to enable SSH so we can log in over a network connection. You can read more about the reasonings for this here.

Luckily, this is easy to do. With the SD card still plugged in, navigate to the boot partition and create a blank file named "ssh" in that directory.

Still in the console, enter the following commands:

cd ../boot
touch ssh

You should see an empty file named "ssh" appear in the root boot partition.

Create an empty ssh file in the boot partition to enable SSH connections

Unmount the SD card from your host computer and insert it into the Raspberry Pi.

Configure Your Host Computer's IP Address

Plug an Ethernet cable into the Raspberry Pi and the other end into your computer. Technically, we should be using a crossover cable, but since the late 1990s, most computers are capable of automatically detecting and configuring for crossover.

Raspberry Pi connected to computer using an Ethernet cable

Configure your host computer to have an Ethernet static IP address with the following properties:

IP Address:
Subnet Mask:
Default Gateway:

Instructions to set up a static IP address for the following operating systems: Windows, Mac, Linux (Ubuntu).

Connect Over SSH

Secure Shell (SSH) gives us a terminal into an operating system over a network and encrypts the traffic, giving us a level of security. Depending on your host operating system, you have a number of options available to you.


PuTTY is an easy-to-use SSH, Telnet, and Serial terminal client. Open PuTTY, and set the Host Name to and Port to 22.

Using PuTTY to connect to a Raspberry Pi with a static IP address

Click Open. If asked about chaching a host key, click Yes.

Mac and Linux

The easiest way to connect to another computer over SSH is to use the ssh command line tool built into most distributions of Linux and Mac OS. Simply open up a terminal and type:


Update: Users may need to use ssh pi@<"IP Address">, where pi predefines the login username.

Log In

Once SSH connects, enter the default login credentials:

  • Username: pi
  • Password: raspberry

You should be presented with a command prompt, if all goes well.

Logging into a Raspberry Pi over SSH