Introduction: How to Use SSH With Raspberry Pi 2
SSH stands for Secure SHell
Its an encrypted network protocol that enables you to access the command line of a device wireless-ly from a remote terminal.
What it means for the raspberry pi is that it doesn't need to be connected with a display or input devices like keyboard and mouse. As long as it is connected to a network, you can put it anywhere (behind a table, above a cupboard, in a drawer) and still be able to use all the sweet features it provides.
Example Scenarios where SSH might be used:
- Web Server
- Ambient Lights
- Whether Station
- Security System
- The List can go on and on....
Raspberry Pi being the awesome little computer that it is, almost all its aspects can be controlled through it's command line and thus in turn via SSH. You can control the GPIO pins, run an application, write a program and more without ever being near it.
I am using the Raspberry Pi 2 here as an example but the processor is the same for all the models of the Pi.
Continue reading to see How To Connect To The Raspberry Pi via SSH or watch the video HERE.
Step 1: Ready the Pi and Enable SSH
We need to make sure that the host is ready to accept a SSH connection.
Many of the Operating Systems offer SSH but I'll be using Raspbian since its the most popular.
We need to connect a display as well as a keyboard initially but we won't need them later on after the Pi has been set-ed up.
1. Insert the SD. Connect a display and a keyboard. Connect power and let the device boot up.
2. Login and run the following command in the command line or the terminal.
In Raspbian Jessie you can open the configuration tool from the menu in the desktop environment but the above command still works.
3. Go into 'Advanced Options' and select SSH.
4. Enable it and exit the configuration tool by selecting finish.
Step 2: Give It a Static IP
This Step is not absolutely necessary but is highly recommended.
If the Pi disconnects and reconnects to the network then there is a chance that it's IP Address will change. In case this happens you will have to find it's IP Address again which can be a bit inconvenient.
To see How Give The Raspberry Pi a Static IP check out the Instructables HERE
Watch the video HERE
Step 3: Find the IP Address
The IP Address of a device is it's location on the network. Every device is assigned an IP by the router.
This IP will enable our SSH client to find the Raspberry Pi on the network to connect to it.
To find the IP of the Pi run the following command in the command line or the terminal:
The sequence of numbers in front of 'inet addr:' is the Pi's IP Address. Note this down.
For me the IP was 192.168.137.82 . This will most probably be different for you, so make sure to use your own.
Also note that whenever the Pi connects to the network there is a chance that this IP might change. In this case you will have to repeat this step. To avoid this from happening you should give the Pi a static IP. To do so refer to the previous step.
You can now disconnect the display as well as the keyboard. We won't need them hence forth.
Step 4: Setup the Client
The device which you will use to access the command line of the Raspberry is the client. Make sure that this device is on the same network as your Pi.
- Windows requires a SSH Client and the most popular one is PuTTY. Download it from HERE.
- It will be an '.exe' file and won't require any installation.
- Run the 'Putty.exe' file you downloaded.
- Enter the IP address of the Pi that you noted down in the previous step in the text box that says 'Host Name (or IP address)'.
- Make sure that the connection type selected is 'SSH'.
- Click open.
- A window very similar to the command line of the Pi will appear.
- You can login with the username : pi and password : raspberry (won't be visible while typing).
You are now successfully SSH'ed into the Pi.
For Mac Or Linux:
It is easier to use SSH with a Mac or any Linux OS.
Open the terminal and run the Command:
ssh pi@<IP address>
Just replace '' with the IP of your Pi.
This is it! Your are Done!
Android also requires a SSH client and the Play Store has some good ones. Few of them will be linked below.
ConnectBot : https://goo.gl/qKBdoj
JuiceSSH : https://goo.gl/QVsWlY
SS Client : https://goo.gl/Vpq9t7
All of these work pretty much the same as the PC.
I hope this Instructables was useful for you.
If you have any questions or suggestions, feel free to ask them in the comments.
You can watch the corresponding video HERE
Read my other Instructables HERE
Check out my YouTube Channel at : YouTube.com/LiveSparks
Follow me on twitter at : https://twitter.com/LiveSparking
We have a be nice policy.
Please be positive and constructive.