Cart 0

Remote Access - The Command Line

Raspberry Pi RDP SSH Telnet VNC

I must admit that I rarely hook my Pi's up to a screen. Instead, I access them remotely from one of my other PCs; what I mean by this is that I use the keyboard, mouse and screen of my PC to control the Pi, displaying what is on the Pi using one of three different methods. I have already written about using VNC to display what is on the desktop of the Pi.

However, much of the time I just want to use the terminal or command line interface. For that, I use SSH, or Secure SHell. You are only able to type commands into a window on your PC, which are transferred to the Pi and run.

Example Terminal Window

Setting up the Raspberry Pi

The Raspberry Pi needs to be running an SSH server. This may already be running. To find out, run the following in a terminal window on your Pi:

ps ax | grep sshd

If the SSH daemon is already running, then you will see a line similar to this:

2163 ? Ss 0:00 /usr/sbin/sshd

In which case, you don't need to do anything. If you don't see that line, then you need to switch the SSH daemon on using the Raspberry Pi configuration program:

sudo raspi-config

This will display a list of options:

Raspberry Pi Configuration

Using the down cursor key, move down to Advanced Options and press the return key.

Advanced Options

And under there, choose the following line:

And then choose the option to Enable SSH and press return:

Exit the configuration tool by using the right cursor key to highlight Finish. The secure shell server will then start, enabling you to remotely access your Pi using a SSH client from another computer.

But won't that mean that everybody can access your Pi? No, it does not - you still need a username and password to log in, and everything that goes between your computer and the Pi will be encrypted - hence the name of Secure Shell!

SSH Clients

You will also need an SSH client on the computer that you are using to access the Pi, whether PC, Mac, Android or another Pi.

The Raspberry Pi already has an SSH client built in. Just type ssh pi@otherpi (where 'otherpi' is the hostname or IP address of the Pi you want to connect to) in a terminal window. You will be prompted for a password, and then you are in.

On your PC and Mac there are a number of different clients. One of the simplest is 'KiTTY', which offers more than just SSH. You can download it from here.

On installing and running, you are presented with the KiTTY configuration window.

All you need to do is enter the hostname or IP address of your Pi and select SSH. This should automatically set the port number to 22. Click on 'Open' and the terminal window will open requesting the username of your Pi - which is probably 'pi', followed by the password - the default is 'raspberry'.

You are now able to run commands on your Pi as though you were running directly on your Pi.

Older Post Newer Post