Raspberry Pi 2 : SSH Basics

Use SSH and work your Raspberry Pi  or Banana Pi  from another PC on your network

SSH or Secure Shell allows you to connect  to a remote machine using a secure encrypted connection and enter commands remotely.

In other words, Plug in your Pi to power, connect it to the network and use it as a headless (no monitor, keyboard + mouse) and use your regular PC to operate your Pi.

Overview :

  • Download and boot the Pi with Raspbian.
  • Enable SSH in the Raspberry Pi configuration page.
  • Find out the IP address of your Pi.
  • Download and Install Putty on your regular PC.
  • Connect to your Pi remotely.

Time and Difficulty :

  • Time : About 5 mins once you have the Image file and the rest of the software.
  • Newbie Difficulty level : Ridiculously Easy

 

To enable SSH on your Pi,
  1. Boot up your Pi with Raspbian after connecting the Pi to a TV/ Monitor and Keyboard. (You will not need an network connection for this  step).
  2. Once the Pi has started up, Log in with your username and password (the default for the Raspberry Pi is “pi” as username and “raspberry” as password)
  3. Enter “sudo raspi-config” to bring up the  Raspberry Pi Software Configuration Tool.ssh0
  4. Use your cursor keys and navigate to Advanced Options
  5. Select SSH under advanced options and choose <Enable> (The screen will flash and you will get a confirmation that the SSH has been enabled)ssh1
  6. Click finish and then to shut down you Pi, enter “sudo halt -h
  7. Your Pi can now be accessed remotely as long as it is connected to your network via your Router. You will no longer need the keyboard or a Monitor to be connected to it.
To Remotely connect to your Pi,

You will need to find out the IP address assigned to your Pi. Since your Pi is running with a monitor, you will need to log in to your router and find out the ip address.  Refer Step 2 to give your Pi a static ip.

A SSH Client is needed on your PC to connect using SSH. For Windows users, the most popular of these is a program called PuTTY. Which can be downloaded here. (Choose the Windows installer. Mac and Linux users have to enter via the Terminal command line. )

Once installed, Fire up Putty and enter the IP address of your Pi and Port (the default is 22 )ssh2

Choose SSH as the connection Type and Click Open

You should see a terminal window with a Log in prompt.ssh3

Log in and you are now using your Pi remotely. 

 

Security Foot Note :

IF you are going to use SSH to access your Pi that is hosting data, I strongly recommend you follow standard “SSH Hardening” protocols.  Askubuntu.com has a great forum on this topic.

At the very least, change default passwords, create a new user for SSH access and disable access via SSH for users “root” and “pi”.

Combine SSH use with fail2ban that monitors and bans IP addresses that try to log in and fail.

Lastly, wikipedia quotes “The encryption used by SSH is intended to provide confidentiality and integrity of data over an unsecured network, such as the Internet, although files leaked by Edward Snowden indicate that the National Security Agency can sometimes decrypt SSH.[3]

 

 

 

Leave a Reply