Pages Menu
Categories Menu

Posted by on Apr 5, 2015 in e-Linux, Featured, Getting Started, Raspberry Pi, Single Board Computers | 3 comments

Raspberry Pi – Headless Setup

Raspberry Pi – Headless Setup

So you got your hands on your Raspberry Pi and booted it up. Great! But what if you don’t have access to a TV/monitor and keyboard/mouse all the time? But hey, you always keep your laptop/computer around. Wouldn’t it be great if you could use your laptop’s screen, keyboard and mouse to control your Raspberry Pi? Well.. read on!

The method discussed here is one of the simplest ways to get started. It uses SSH with X11 forwarding to display your RPi’s desktop on your computer screen!

NOTE: From now on, I have used the terms RPi and Raspberry Pi interchangeably.

Steps Involved

Whether you’re using a Windows, Mac or Linux computer, the basic steps involved remain the same.

There are two ways to display the desktop environment – X11 forwarding and VNC. Whereas VNC launches an entire desktop session, X11 is capable of launching individual application windows. I almost always use X11 since it is light and doesn’t require a separate server running on the RPi (unless you actually start one yourself), but it totally depends on you which one to use.

We will learn about X11 forwarding in this post. VNC will be discussed in future post.

Step 1: Connecting RPi to the network

The idea behind this approach is that your RPi and your computer need to be connected to the same network. There are two ways to do this.

Method 1

Connect your RPi to the same network your computer is connected to. This means hooking up your RPi to your modem/router. Be aware that this will connect your RPi to the internet. This can achieved using either Ethernet or Wi-Fi. We have covered Ethernet connection in this post. Connecting your RPi to the network using Wi-Fi requires a separate Wi-Fi dongle and will be covered in a future post.

Raspberry Pi Headless Connection - Method 1 (Click to Enlarge)

Raspberry Pi Headless Connection – Method 1 (Click to Enlarge)

Method 2

If you don’t have access to your router or if you can’t connect to your router due to encryption/security issues, then you might need to create your own LAN network between your computer and your RPi. Simply hook your RPi with your computer with an Ethernet cable. Unless you explicitly share your computer’s network with your RPi, there will be no internet connection available to your RPi.

Raspberry Pi Headless Connection - Method 2 (Click to Enlarge)

Raspberry Pi Headless Connection – Method 2 (Click to Enlarge)

Step 2 – Determining IP Address

Once your RPi is connected to the network, it will have an IP address assigned to it. You can make the IP static (IP remains same every time you connect) or dynamic (IP changes every time you connect). You need to have dynamic IP for the server in order to connect to the internet. Depending upon the situation, you might need to configure RPi to use static IP address. If you are using static IP address for your RPi, then skip to the next step (step 3).

Since you don’t know the IP address of your RPi (dynamic), the idea is to scan all the IP addresses in the range that your router/gateway corresponds to. If you are using a Windows computer, type the following:


On a Mac/Linux machine, type the following:


The things that you’ll be searching for are your IPv4 address and your gateway’s IPv4 address. If your computer is connected via the Ethernet, look for it in eth0 or Ethernet adapter section. If your computer is connected via Wi-Fi, look for it in wlan0 or Wireless adapter section.

Determining IP Address for Method 1

For instance, if you have connected your RPi to your router/modem and your gateway’s IPv4 address is, scanning through all the IP addresses in the range of through would be a good idea.

Another option could be to log into your router’s admin portal and look at the device table. You can access the router’s admin portal by typing the gateway IP address in your web browser. You need to know the login credentials of your router though, which can usually be found beneath it.

Determining IP Address for Method 2

Let’s take another case where you have connected your RPi to your computer directly via Ethernet and your computer is connected to the internet via Wi-Fi. Here you would like to find out the IPv4 address of your Ethernet port. This gets confusing since there will be two IP address domains – one for Wi-Fi, another for Ethernet. Say, your gateway’s IPv4 address is and your Ethernet’s IPv4 address is for IPs in your gateway’s range will lead you nowhere. You’ll need to look for your RPi in the range of your Ethernet’s IP, for instance through

Remember to share your computer’s network connection through your Ethernet port. This should be straightforward for Linux, Mac and Windows.

Scanning IP Addresses

You can use applications such as Angry IP Scanner (Windows/Mac/Linux) or Advanced IP Scanner (Windows only) to scan all IPs. Several command line tools like nmap are also available for Linux/Mac. These tools are pretty simple to use which you should figure out in no time. (Yes, I am being lazy and don’t want to write how to use them. I’ll attach screenshots though!) :)

IP Scanner Result - Windows

Advanced IP Scanner Result – Windows

Angry IP Scanner Result - Mac/Linux

Angry IP Scanner Result – Mac/Linux

On Linux and Mac, you can also try:

arp -a

Or if you wanna scan the range of, use nmap:

nmap -sS

Step 3 – SSH with X11 Forwarding

SSH stands for Secure Shell. It is used to access and execute shell commands in Linux/Unix based Operating Systems remotely. Linux and Mac natively support SSH and have a client pre-installed. Windows systems will require a third party SSH client to achieve this.

SSH using Linux/Mac Machines

Simply open up terminal and type:

ssh <username>@<ip-address> -X
ssh <ip-address> -l <username> -X

In my case I had to type:

ssh pi@ -X
ssh -X -l pi

The -X is used to enable X11 forwarding. If this doesn’t work, try replacing -X with -Y.

If you have never connected to the specified IP address before, the SSH client throws a warning and asks you to confirm it. Type “yes”. It should then ask for password for the user “pi”. The default password is “raspberry”.

NOTE: Linux/Unix based systems do not display the password (not even asterisks) while typing. So don’t be alarmed, type your password, have faith, and press enter. :)

Here’s a sample of how it should look like:

SSH with X11 Forwarding - Mac/Linux

SSH with X11 Forwarding – Mac

SSH with X11 Forwarding - Linux

SSH with X11 Forwarding – Linux

That’s it! You’re now logged into your Raspberry Pi! Type the following and see what shows up:


SSH using Windows Machine

Since Windows doesn’t come with a default SSH client, a separate third party client is needed. The most popular SSH client for Windows is PuTTy. Download and run it (no installation required).

To enable X11 forwarding, in the left sidebar (category), go to Connection // SSH // X11. Check the “Enable X11 forwarding” check box.

PuTTy X11 Configuration - Windows

PuTTy X11 Configuration – Windows

To establish the connection, go to Session, specify the IP address and choose SSH as connection type. Port should be 22. Click on Open.

PuTTy Launch Session - Windows

PuTTy Launch Session – Windows

Once again, if this is the first time you are logging into the host/IP, the client will ask for your confirmation. Click “Yes”.

PuTTy Security Alert - Windows

PuTTy Security Alert – Windows

It should now ask you to “login as:”. This is where you enter the username “pi”. Next comes the password. Type the default password “raspberry” (unless you have changed it).

NOTE: Linux/Unix based systems do not display the password (not even asterisks) while typing. So don’t be alarmed, type your password, have faith, and press enter. :)

PuTTy Login - Windows

PuTTy Login – Windows

Sweet! You’re now logged into your Raspberry Pi! :) Type the following and see what happens:


Step 4 – Launching X Session

Now that you are logged into your Raspberry Pi, all that remains is to display the desktop on your computer screen. This is what we have been trying to do so far, right?

Linux and Mac machines usually have an X11 client pre-installed. In case of Windows, download and install Xming with default settings. Make sure to launch Xming.

Then type the name of any application in the SSH terminal window and see the application window pop up. Example:


Here’s screenshots for Windows and Linux. For some reason I wasn’t able to take screenshots in Mac.

X11 App Launch - Windows

X11 App Launch – Windows

X11 App Launch - LinuxMac

X11 App Launch – Linux/Mac

If you want to start an entire desktop session, then type:


This should start an entire full fledged desktop session on your Raspberry Pi. I don’t have a screenshot for Mac/Linux, but trust this works! You might need to tweak the X11 settings in some cases. In case of Mac, make sure that you’re switching to full screen view by pressing Cmd+Alt+A. In some cases you might see the OS menu missing, which is OK. You should still be able to access them from your file system.

Raspberry Pi Desktop using Xming - Windows

Raspberry Pi Desktop using Xming – Windows


If you ever wanna kill a running process in Linux, press Ctrl+C (sometimes Ctrl+X). To log out from your current session, type “logout” or press Ctrl+D. To shut down your RPi, type “sudo halt”.

That’s it, you’re all set to go wild! Shall you have any questions, comments, personal views, appreciations, post them below!


There isn’t much to write in the summary section except the four steps followed. In order to maintain my status of laziness, I’ll return you guys here. Please don’t get caught in an infinite loop. :)

Written by Mayank Prasad (Max) and Prashant Agarwal


  1. Hello Max,
    I flashed Windows 10 Iot Core tools on the sd card of raspberry pi. I am unable to make a headless setup.Even Advanced Ip scanner isn’t showing the Ip address of the pi.
    Please help me.
    With Regards,

  2. Instead of using X11 why not remote desktop?

    • You can. No one’s stopping you. You’ll be using SSH anyways for many reasons, and it supports X11, so why not use it? But sure, go ahead, use VNC or anything that lets you in to the Pi. :)

Leave a Reply

%d bloggers like this: