Raspberry Pi - Enabling SSH for Remote Access
Wednesday, August 15, 2012 at 9:45PM
Robert Savage in Embedded Computing, Raspberry Pi, Raspberry Pi, emulation, pi, raspberry, ssh, terminal

For some applications you may not want your Raspberry Pi permanenenty attached to a monitor and keyboard or perhaps you just would like to be able to access your Raspberry Pi remotely.  Enabling the SSH server on your Raspberry Pi will provide SSH terminal access over your network.  This article will cover the steps need to enable the SSH server for remote access and how to connect to the Raspberry Pi using a SSH terminal enumation software from Windows and Mac OSX.  

Enable SSH Server on Raspberry Pi    

NOTE:  

If you are running the Raspian "Wheezy" image or the Debian "Wheezy" image, please note that SSH is already enabled by default.  You can also use the Raspberry configuration utility to enable/disable the SSH server by running the command and selecting the SSH item from the menu: 

sudo raspi-config 

 
You can skip this section and proceed to the next section in the article.

From the console on the Raspberry Pi please enter the following two commands:

sudo rm /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server

These steps will create the RSA and DSA encryption keys enable the SSH server.  The SSH server will also be started automatically each time you reboot your Raspberry Pi.  

Now, lets get connected.

Getting the IP Adrress from your Raspberry Pi    

Before we can connect remotely, we first need to determine what the IP address is for the Raspberry Pi.  For most users, when the Raspberry Pi boots up and is connected to you router/switch/residential gateway it will dynamically obtain an IP address using DHCP.  

Use the following command from the console to get the IP adress:

ifconfig

In the resulting output on the screen, look for the inet add for the eth0 device.

Connect from Windows

You can use any terminal emulation software you like; however, for this demonstration we will use Putty a very popular an free terminal software for Windows.

You can download the Putty software here.

Double click the putty.exe program to start Putty.  You will be prompted with the Putty configuration dialog.  Enter the IP address of your Raspberry Pi in the Host Name field and make sure the the connection type is set to SSH.  

To persist these setting so you don't have to re-enter them every time you start Putty, enter a name such as "RaspberyrPi" in the Saved Sessions field and press the Save button.

Click the Open button to connect to the Raspberry Pi and start the SSH session.
You will be prompted with a message to cache the RSA2 fingerprint.  Select Yes to accept the key and continue the connection. 

Upon connection, you will need to provide the authentication credentials to logon to the Raspberry Pi. 
The credentials may vary depending on the operating system image that you installed on your Raspberry.  If you loaded Raspian "Wheezy" or Debian "Squeeze" then use username "pi" and password "raspberry".    

Now you can interact with your Raspberry Pi just as if you where setting at the keyboard console.  

Connect from Mac OSX

No additional software is needed for OSX to connect to the Raspberry SSH server.  Just open theTerminal application and enter the ssh command with the username@ip-address format:

ssh pi@10.1.1.194
Upon connection, you will be prompted with a message to permanently accept the RSA fingerprint. Enter "Yes" to accept the key and continue the connection.  Next, you will need to provide the authentication password to logon to the Raspberry Pi.  The credentials may vary depending on the operating system image that you installed on your Raspberry.  If you loaded Raspian "Wheezy" or Debian "Squeeze" then use username "pi" and password "raspberry".   

Upon connection, you will need to provide the authentication credentials to logon to the Raspberry Pi.  The credentials may vary depending on the operating system image that you installed on your Raspberry.  If you loaded Raspian "Wheezy" or Debian "Squeeze" then use username "pi" and password "raspberry".   

Now you can interact with your Raspberry Pi just as if you where setting at the keyboard console.  

 

Article originally appeared on SHA (http://www.savagehomeautomation.com/).
See website for complete article licensing information.