Setting Up Your Raspberry Pi For Headless Use With SSH

Ads by Google

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!

Ads by Google

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.

Join live MakeUseOf Groups on Grouvi App Join live Groups on Grouvi
Raspberry Pi Projects
Raspberry Pi Projects
70 Members
DIY Tech Projects
DIY Tech Projects
67 Members
Arduino Projects
Arduino Projects
60 Members
Ads by Google
Comments (12)
  • Klay Adams

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

    • Christian Cawley

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


      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.

  • Luis Garcia

    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

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

    • Luis Garcia

      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.

  • Ahmed Khalil

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

  • Aneesh Anand

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

    • Christian Cawley

      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

      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?

  • Sean A

    cool idea i would love to try it

Load 10 more
Affiliate Disclamer

This review may contain affiliate links, which pays us a small compensation if you do decide to make a purchase based on our recommendation. Our judgement is in no way biased, and our recommendations are always based on the merits of the items.

For more details, please read our disclosure.
Affiliate Disclamer

This review may contain affiliate links, which pays us a small compensation if you do decide to make a purchase based on our recommendation. Our judgement is in no way biased, and our recommendations are always based on the merits of the items.

For more details, please read our disclosure.