How to SSH into a Raspberry Pi

You will often want to execute commands over SSH instead of having to Remote Desktop or access your Pi via a monitor and keyboard.

Here’s how to get SSH setup on your Pi.

Enable SSH

Via Pi Terminal

sudo nano /boot/ssh

Hit CTRL+O to Save, Hit Enter, Hit CTRL+X to exit.

sudo reboot

Via Boot Disk

1. Insert SD card with Raspbian onto your host machine (laptop, desktop)
2. Create an empty file without an extension called `ssh`` in the root of your boot drive.

You can do that manually with Windows Explorer or you can open a command prompt and execute the following:

Windows

cd into the SD card drive letter, i.e. g:

Linux
cd /Volumes/boot

Create SSH file

touch ssh
  • Insert SD Card into Raspberry Pi and boot it. SSH will be enabled.

Via UI

  • On your Pi, go to Preferences -> Raspberry Pi Configuration
  • Click ‘Interfaces’ and Enable SSH, Click OK

Install Putty on Desktop

I use Putty as my SSH client. Download and install it from: http://www.putty.org/

Create SSH Connection

Open a command prompt and execute the following:

putty.exe -ssh pi@raspberrypi

Replace ‘pi’ with your username if you changed it and replace ‘raspberrypi’ with your hostname if you change it.

If you cannot find your Pi by hostname, then you’ll need to follow these steps to configure Samba so your hostname appears on your network.

You will now be connected to your Pi over SSH.