Setting Up Your Raspberry Pi For Headless Use With SSH

Christian Cawley 16-11-2012

setting up raspberry piThe Raspberry Pi is – as we’ve seen in several previous articles – an extremely flexible piece of hardware. Once you’ve installed an operating system, got to grips with the small dimensions, and found a case for it, you’ll be able to install media centre software and perhaps even begin programming software (after all, that’s what it was designed for!).


However, you might find that the business of plugging the Raspberry Pi into your big screen plasma TV – the only device in your house with a HDMI connection – is a bit tiresome while your family is watching their favourite show. Alternatively, you might have more than enough HDMI displays but not enough keyboards.

Benefits of SSH

Fortunately, the Raspberry Pi can accept SSH commands when connected to a local network (either by Ethernet or Wi-Fi), enabling you to easily set it up.

The benefits of SSH go beyond upsetting the daily screening of The Simpsons or the latest celebrity news – using your Raspberry Pi without a dedicated display (also known as “headless”) can allow you to leave the device set up in a particular configuration without the worry about anyone disrupting things.

Using the Pi as a NAS interface? No problem! If your Raspberry Pi spends its life as low-fi web server or Internet radio, then it has no need for a dedicated display.

This is where SSH comes in!


Setting Up the Raspberry Pi for SSH

In order to prepare your Raspberry Pi for remote connections over SSH, you should have first installed the Debian distro Raspbian, as described previously. By default SSH is enabled, but if you have it disabled you should enter the config screen to re-enable.

With your mini-computer plugged into the mains and with a keyboard and Ethernet cable connected, boot up and login to the device.

setting up raspberry pi

Once you’ve done that, enter sudo raspi-config to open the configuration screen, and use the arrow keys and Enter to select the Enable or Disable SSH option. In the next screen, select Enable, tap Enter and the in the final screen Enter again to select OK.


With SSH now enabled, you will be able to remote connect to your Raspberry Pi using an SSH client.

(Note that if SSH is not listed as a menu option, you are probably using an old build of the Raspbian distro and should update as soon as possible!)

Connecting to Your Raspberry Pi

Before connecting to your Raspberry Pi, you will need to check the IP address. There are a couple of ways of doing this.

set up raspberry pi headless


The first, from the command line, is to enter ifconfig to display your network connection details, including the IP address. Alternatively, you can check your router for connected devices and ascertain the IP address that way.

With this information to hand, you’re now ready to connect with SSH.

If you’re using Windows, the best SSH tool is probably PuTTY, available from Once downloaded (select putty.exe for this task), double click the executable – it will run without installation.

setting up raspberry pi


In the Session screen, add the IP address in the Host Name field and click Open. PuTTY will issue a security notice – click Yes to continue, and then login to the Raspberry Pi.

Moments later you will see the Raspberry Pi text-based interface!

You can now disconnect the keyboard, mouse and HDMI cable from your Raspberry Pi, and issue commands remotely.

Issuing Remote Commands to the Pi

Various commands can be issued remotely to the Raspberry Pi via SSH – pretty much anything that doesn’t disable or interrupt SSH or your network connection!

ps ax

This will display a list of running processes.

$ ssh –V

Displays the current SSH version

Files can be copied to and from the Raspberry Pi using SSH:

localhost$scp loginname:/home/username/remotehostfile.txt remotehostfile.txt
localhost$scp localhostfile.txt loginname:/home/username/localhostfile.txt

Once you’re done, remember to safely shutdown your Pi with the command:

sudo shutdown -h now

(Changing –h to –r will reboot the device). This must be done before removing the power cable – failure to do so can easily lead to a corrupted SD card, which will mean reinstallation of the Raspian OS.

Updates, Application Installs and Command Line Use – by Remote!

There are certain things that SSH is no good for. For instance, it won’t allow you to access the Raspberry Pi’s GUI, but it will provide you with the means to run updates, install applications and use various built-in programs and tools from a different computer.

With the easy configuration of SSH by remote and commands listed above (and many more) you can quickly and efficiently send instructions to the device using PuTTY on Windows or via the native command lines tools in Mac OS X and other Linux distros.

All in all, if you own a Raspberry Pi you should be aware of how convenient and useful SSH is. If you plan to use SSH regularly, you might want to learn this boot partition hack 6 Ways to Hack a Raspberry Pi via the Boot Partition Want to get your Raspberry Pi online faster? Try these /boot/ partition hacks to save time setting up your Raspberry Pi. Read More to enable SSH quickly when you need it.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

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

  1. Francis gan
    July 19, 2017 at 1:12 pm

    Thanks for your sharing
    Very good

  2. Pawel
    December 4, 2016 at 1:44 pm

    Recent security uptade for Raspbian (end of Nov 2016) disabled SSH by default. You will see Pi's IP but when you try to connect via SSH you will end up with "Connection refused" message. To enable SSH on fresh Raspbian image for headless start create file named "ssh" in the /boot/ directory. You can do it on Windows, Mac etc. right after you write image to sd card. On Windows make sure file does not have any extension.

  3. Klay Adams
    March 7, 2015 at 8:54 pm

    How do I actually see the pics display on the monitor and not a command line

    • Christian Cawley
      March 12, 2015 at 3:13 pm

      type startx but this will not work over SSH, only when the Pi is connected to a monitor.

    • Anonymous
      July 12, 2015 at 6:38 pm

      after booting Pi with Putty, run the following command
      sudo apt-get install xrdp

      now open Remote desktop application (if you are on windows PC)
      enter the Pi ip address and connect
      on prompt, enter the username and password for Pi and connect
      now you can access the GUI.

  4. Luis Garcia
    February 13, 2013 at 7:46 pm

    hiya, i have an issue with my rasp and ssh. here's the thing ssh works (inside and outside of my network) i can log in perfectly but after a while it just stops i cant ssh into the raspberry at all, pings also sometimes return but most of the time its just a timeout.

    my desktop monitor has a few usb ports i have it connected there i find it supplies enough power to run everything. My question is does it really? does lack of power affect ssh functionality? should i just use a direct DC connection?

    • Christian Cawley
      February 13, 2013 at 8:40 pm

      Great question - in my experience I would say always use the DC mains adaptor to power the Pi.

      • Luis Garcia
        February 15, 2013 at 9:03 am

        hey there, been connected directly to DC for a day now with 0 ssh issues. Aparently once the monitor goes to stand by there isnt enough power for the raspberry.

  5. Ahmed Khalil
    November 17, 2012 at 12:52 pm

    we need more technical articles about this computer and how to make use of it

  6. Aneesh Anand
    November 17, 2012 at 9:15 am

    saw one recently. Wondering how it can replace my desktop PC for gaming. Any idea i can do it like that?

    • Christian Cawley
      November 17, 2012 at 9:30 am

      The best way is to stick to retro, pre 2000 titles, I would say, using emulators. I may be wrong with the day, it could be +/- a couple of years.

      RPi excellent for many things but it won't replace a gaming PC.

      • Aneesh Anand
        November 17, 2012 at 9:57 am

        thnx for the reply. But this as a media player, (put in a box, connect the IDE HDDs which i managed to put together and extend to a converter cable with USB out) will do any good? I am using the current HDD box setup directly with a USB enabled LED TV now. Will I get a faster interface where i can browse, search, copy and delete (as in windows/ubuntu), and more media format and resolution support?

  7. Sean A
    November 17, 2012 at 5:55 am

    cool idea i would love to try it

  8. thedude
    November 17, 2012 at 12:38 am

    what about "ssh -X" wont that allow X11 forwarding so you can access raspberry pi's gui's ?
    Just guessing,..I dont own a pi, but I do have a few linux and Sun boxes.