Introduction

SSH (Secure Shell) on a Raspberry Pi allows you to remotely connect to the Raspberry Pi via a terminal or command-line interface. It provides a secure way to access the Raspberry Pi’s operating system, run commands, manage files, and configure applications — all without needing a keyboard, screen, or mouse connected directly to the Raspberry Pi.

To connect to our Raspberry Pi, we will use PuTTY, which is a free SSH client. If you need to see the graphical interface of your Raspberry Pi, such as the desktop, we recommend checking out our tutorial on VNC for Raspberry Pi.

Raspi-Config

The first step is to make sure SSH is enabled on your Raspberry Pi. To do this, open a terminal and type the following command:

sudo raspi-config

Here is the raspi-config menu where you can change your Raspberry Pi’s settings.

Click on 3. Interface Options:


In Interface Options, click on SSH:

When you click on SSH, you will be prompted to enable it. Select Yes.

You will then see a success message indicating that SSH has been successfully enabled on the Raspberry Pi:

Your Raspberry Pi’s Address

To connect to your Raspberry Pi, you have two options:

  • Use its hostname (if you know it)

  • Use the IP address of your Raspberry Pi

Getting the Hostname

To get the hostname, open a terminal and type:

hostname

Getting the IP Address

To get the IP address of your Raspberry Pi, open a terminal and type:

ifconfig

In the output from your Raspberry Pi, you will find its IP address depending on whether it is connected via Wi-Fi or Ethernet cable:

Here’s what the different rectangles in the image on the right represent:

  • Red square: If your Raspberry Pi is connected via Ethernet cable, you should find the IP address in this area.

  • Green square: This square is reserved for the Wi-Fi section of the board. You will find the IP address here if you are connected via Wi-Fi.

  • Blue square: This is the IP address of our Raspberry Pi. We can use it to connect remotely.

Putty

PuTTY is an open-source software that allows you to create secure connections using the SSH protocol. By using PuTTY, you can connect to a Raspberry Pi (or any other remote server) via the command line and execute commands remotely. PuTTY is a lightweight and efficient solution for managing remote systems, whether for servers, workstations, or IoT projects.

To download PuTTY, you need to go to the following link:

Once on PuTTY, select SSH and enter the IP address of your Raspberry Pi or its hostname:

Then click Open to start the session.

If this is your first connection to the Raspberry Pi, you’ll be asked to confirm that you want to connect. Click Accept.

After entering your Raspberry Pi username and password, you will be connected to your device via SSH:

If this is your first connection to the Raspberry Pi, you’ll be asked to confirm that you want to connect. Click Accept.

After entering your Raspberry Pi username and password, you will be connected to your device via SSH: