My Account

Wish List (0)

Saved Carts

Compare

Remotely Accessing the Raspberry Pi via SSH – Console Mode

October 22, 2013

This guide will walk you through the steps to logging into your Raspberry Pi's console from another PC or laptop. The method utilises Secure Shell (SSH),  a secure network protocol for data communication, which is very useful for remote operation via command-line. Via SSH, you can quickly copy text or files across to your Pi's command line instead of typing it all out. You need two computers - a server (your desktop) and a client (the Raspberry Pi).

It's surprisingly easy, and when you're fiddling about with files, and want to edit stuff accurately without typing lines of text, it's sometimes easier to copy and paste script via a regular desktop PC or laptop remotely and directly to the Raspberry Pi console. Accessing via SSH is also very useful if you want to take decent screenshots!

This guide will be completed on Raspian, which is the offical and recommended Raspberry Pi Operating System available on the NOOBS distribution from the Raspberry Pi Foundation:

www.raspberrypi.org

We'll also be running Windows as the server, although the software is available for Mac and Linux users too.

Step 1 - Give your Raspberry Pi a Static IP.

To log in to your Raspberry Pi remotely, you'll need the IP of the Raspberry Pi – this is basically like your house address and tells the host computer where to look for it on the network. By default, the Raspberry Pi will be given an IP automatically by the router (called Dynamic IP) when you connect to a network. However, this can change whenever you remove the Pi from the network e.g. turn it off. It's therefore very useful is the IP never changes, hence a 'static' IP.

Please follow the below tutorial on setting up a static IP on the Raspberry Pi. Then pop back here!

Tutorial - How to give your Raspberry Pi a Static IP Address

If you don't want to set up a static IP, or maybe you want to set up the static IP via SSH, then use the following command to grab your Pi's current IP.

ifconfig

The address you need is the inet addr.

Step 2 – Install Pi Software

First we need to install the SSH service on the Raspberry Pi. One command is all you need. . . .

sudo apt-get install ssh

It was actually pre-installed on my Raspian distribution, so you might not need to change anything. However, if not it will only take a few minutes to complete, just say yes when it asks :)

SSH will be set to load automatically when you boot your Pi, so there's no real set up that's required. If you want to fiddle (not recommended), you can start and stop different SSH services with the /etc/init.d files. There are a number of commands, start, stop, restart etc. To obtain a list of the commands, type:

​/etc/init.d/ssh

For example, to check the current status of ssh:

/etc/init.d/ssh status

Step 3 - Install the SSH client on your computer

Next download an SSH client to your computer.

We are going to use Putty, which is open source software available with source code, and developed and supported by a group of volunteers.  Putty is great for gnerally browsing around your Pi's folders and copying files to or from a Windows PC. Follow the link below to download putty:

http://www.putty.org/

It's stand alone, so requires no installation, just download it and open the program!

First of all, you might want to change some settings. If you're used to Windows click mouse controls e.g. right click opens menu to copy and paste, then change the settings to those in the picture below. "Compromise" is quicker for copying script across, but it completely threw me the first time I used Putty!

Next, hit the session tab. . . 

Then, simply type your Raspberry Pi's IP address (the "inet addr" that we defined statically earlier). It's best to save these settings so you won't need to type in the IP address everytime you want to connect. Just type a name under "Saved Sessions" and hit "Save" once you've inputted the correct IP:

Then simply hit "Open", to start the session:

The first time you log in, you'll get a security message. Simply hit yes and continue - you should be relatively sure that you're accessing the correct device!

Now log into your raspberry pi as usual.

Login: pi

Password: raspberry

That's it! You can now type, copy and paste commands and generally screw around on your Raspberry Pi's command line!

If you want to boot to the GUI (startx), you need a slightly different method, we go through this here:

Remotely Accessing the Raspberry Pi via RDP – GUI Mode

Tags: putty, console, console-mode, lan, secure-shell, pc, raspberry-pi, remote-access, remote, access, ssh Last update: September 10, 2015

12 Comments(7 Replies)

Leave a Comment

Leave a Reply

* Name:
* Comment:
* E-mail: (Not Published)
Website: (Site url with http://)
Verification code: