Developing applications for your Raspberry PI, you will often need to connect to the Raspberry PI from another computer to deploy code or run tests etc. The best way to do this is via SSH.
In this tutorial, I will provide instructions on how to enable SSH (Secure Shell) on your Raspberry Pi, which will enable you to remotely access the Raspberry Pi via SSH.
I will not provide a detailed discussion of the in depth discussion of SSH, but I will give you enough information to enable you to connect to your raspberry pi from another computer.
What is SSH
Secure Shell (SSH) is a command interface and protocol to enable the secure access to a remote computer. It is the tool de jour of network administrators to control linux web and other types of Linux based servers remotely. SSH essentially enables you to connect to your raspberry pi from another computer and enable you to execute Linux based commands as if you are actually logged onto the computer itself.
This type of approach is handy if you want to code on the Pi from the comfort of your laptop. Using this approach you don’t need to connect your keyboard, mouse or TV to your raspberry pi, all you need to do is connect your raspberry pi to the network, and you can connect to it.
Although this steps outlined here, are designed to work with raspberry pi, it is important to note that they can be used for any Debian based Linux distribution.
For this tutorial I have made the following assumptions;
- You are confident with the basics of using the Raspberry
Pi,and are able to boot your Pi to the command line
- Your PI operating system is Raspbian
- Your PI is already connected to your network
- you want to connect via SSH to your Pi from another Linux based computer.
The first thing we need to do once your PI has started
This command will show all the relevant network configuration for your PI. Your IP will displayed as
inet addr. Make a note of this as it will be relevant later.
Install SSH on Raspberry PI
I believe all latest version of Raspbian already has SSH prepackaged, however I am going to err on the side of caution and suggest we just install it anyway.
After the install is complete we’ll start the SSH Service
You are also able to stop and restart this service in a similar way i.e.
The one thing I like to do ensure the SSH service starts every time you boot the PI is use the following command which will update a config setting
You can now restart your PI and disconnect it from your Keyboard & Mouse and television if you choose but leave it connected to you network.
Open a terminal window on your linux desktop and connect to your PI using the IP address we retrieved earlier. Remembering the default username = pi and password = raspberry
You can now start any commands you choose to the PI, and these commands will be executed directly on the PI.
To terminate your SSH session after you have finished simply type
The biggest benefit of being able to access your Raspberry Pi via SSH is that you don’t need to have the Pi connected to any screen, keyboards or mice. You Pi effectively becomes a little quiet, low energy consuming, low noise server/computer. As long as it has a network connection you can access it.
A unique background as business owner, marketing, software development and business development ensures that he can offer the optimum business consultancy services across a wide spectrum of business challenges.