Raspberry Pi: Remote Access (SSH)

Posted by: on Sep 14, 2013 | No Comments

raspberry-pi

One of the excellent features of the Raspberry Pi (RPi) is that you don’t need to be sat next to it to use it for command line access. This can be useful if you need to update the software on multiple RPi’s at the same time or if you need to store the RPi’s near a router or in a secure cupboard.

Lets look at SSH (Secure Shell) to start with and move on the remote file access later.

SSH Access

The most recent versions of Raspbian (the default operating system of choice) come with SSH access enabled out of the box. So accessing your Raspberry Pi in this way is relatively straight forward.  If you are using a Windows computer to access the Raspberry Pi, then you will need a free piece of software called PuTTY.

You can download PuTTY from http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe

This will download the main software you need to access your Raspberry Pi via SSH and it does not require any special permissions and does not install anything. When the download has completed you simply run the application and you will launch to the configuration window.

The main configuration window of PuTTY

The main configuration window of PuTTY

 

This may look a little daunting to start with, but the basic use is very straight forward so lets go through it in stages.

Host Name (or IP address)

You will need local access to the Raspberry Pi to get this information so, boot up your Raspberry Pi with a screen attached and a keyboard (no mouse is required for this).

Once you are logged in, issue the command: ifconfig

The address you are looking for will depend on weather you are using a WiFi connection or a Wired connection. I am using a wired connection so I would use the address under eth0. Wireless users would use wlan0.

So, looking at eth0 I look through and find :

inet addr:192.168.1.127

That is the IP address of the Raspberry Pi on my local network. So I would go back to the PuTTy window and enter that address in the Address field:

PuTTY address field

PuTTY address field

Now you can Save this to your PuTTY config to save trying to find it each time.

Saved Sessions - PuTTY

Saved Sessions – PuTTY

Type a name to save this connection into the first box, then click Save.

Now, we are ready to connect to the Raspberry Pi, so go and click “Open” on that window. You will be warned that this is an unknown connection and it will ask if you want to save the SSH key. Click ok to continue.

Login with your normal Raspberry Pi username (Username : pi and password : raspberry are the default).

PuTTY

You are now connected to your RPi remotely and can do anything you can normally do at the command line.

Try issuing the command:

This will upgrade the operating system and any install modules on the RPi.

The “sudo” is just telling the Raspberry Pi to run the command as the high-level user. Without that command, it will fail as as default the user does not have permission to make drastic changes to the Raspberry Pi.

One last note, while connected to a RPi via SSH (or locally) you can SSH from one Raspberry Pi to another:

Vincent is an IT Consultant who has been passionate about technology since lower school. He likes to pass this passion on to others through his posts.

Facebook Twitter LinkedIn Google+ 

Tell us what you think!

x
The ClassThink Guide to Managing iPad in Education
Available on iTunes Soon!

If you'd like us to let you know when our guide is available, pop your email below: