How to Use SSH on Your Raspberry Pi (2024)

In this guide, we will show you how to enable and use SSH on your Raspberry Pi.

How to Use SSH on Your Raspberry Pi (1)

SSH stands for “Secure Shell” and is one of the most useful ways for remotely managing a device such as the Raspberry Pi.

Using SSH, we will be able to interact with the Raspberry Pi’s command line without having to have a keyboard, mouse or screen connected to it. It is very useful for a lot of Raspberry Pi projects that don’t require you to be at the Pi.

The process of using SSH is straightforward and should be easy enough for anyone to pick up.

Unlike other methods for connecting to your Raspberry Pi, such as VNC or RDP, SSH is purely for command line and file access.

Equipment List

Below is a list of the equipment that we used when setting up SSH on our Raspberry Pi.

Recommended

  • Raspberry Pi
  • Micro SD Card
  • Power Supply
  • Ethernet Cable orWi-Fi

Optional

  • USB Keyboard
  • USB Mouse
  • HDMI Cable
  • Raspberry Pi Case

Video Tutorial

If you would like to watch a video on how to setup SSH on your Raspberry Pi, be sure to check out the video below. Alternatively, you can read our written guide below.

Please note, it has been some time since we have updated this video, so it may not correctly reflect the current operating system. Please refer to the text tutorial if you require further help.

Adblock removing the video? Subscribe to premium for no-ads.

Enabling SSH on the Raspberry Pi

There are three different ways to set up SSH on your Raspberry Pi that we will be delving into. For all three of these methods, you should be running Raspbian,

These three different methods are:

  1. Using the Raspbian Desktop Interface
  2. Making use of the Raspi-Config command-line tool
  3. Setting up SSH with a headless (No Screen) setup

All three of these methods are relatively easy to follow, so pick the option that best suits your needs.

One of the first things you should do before or after enabling SSH on your Raspberry Pi is to change the default Raspbian password.

Enabling SSH from the Raspbian Desktop

The first method that we are going to be showing you requires you to be running a version of Raspbian that includes a desktop interface.

For this method, you will need to have a screen, keyboard, and mouse.

1. With your Raspberry Pi loaded, click the Raspberry Pi Icon to bring up the start menu.

How to Use SSH on Your Raspberry Pi (2)

2. Next, hover over the “Preferences” option (1.).

Finally, click the “Raspberry Pi Configuration” option (2.).

How to Use SSH on Your Raspberry Pi (3)

Following these steps will bring up the configuration page where we will be able to enable SSH.

2. Now, to enable SSH on your Raspberry Pi, click the “Interfaces” tab (1.).

Then click the “Enabled” radio box next to the “SSH:” option (2.).

Once you have enabled SSH, click the “OK” button (3.) to confirm the settings change.

How to Use SSH on Your Raspberry Pi (4)

Enabling SSH from the Command Line

This section will show you how to use the command line to enable SSH on your Raspberry Pi.

For this method to work, you will need access to a keyboard, mouse, and screen.

1. The easiest way to enable SSH without a GUI is to make use of the raspi-config tool.

To open the raspi-config tool, run the following command.

sudo raspi-config

2. Within the tool use the arrow keys on your keyboard to select “5 Interfacing Options“.

Once selected, press the ENTER key.

How to Use SSH on Your Raspberry Pi (5)

3. Now in this next menu, select the “P2 SSH” option.

How to Use SSH on Your Raspberry Pi (6)

4. You will see a prompt asking if you want to enable the SSH server on your Raspberry Pi.

How to Use SSH on Your Raspberry Pi (7)

To enable SSH, select the “<Yes>” option and press the ENTER key.

5. SSH should now be successfully enabled.

Select the “<Yes>” option to continue.

How to Use SSH on Your Raspberry Pi (8)

5. Now quit out of the tool by selecting the “<Finish> option and pressing ENTER.

How to Use SSH on Your Raspberry Pi (9)

Enabling SSH on a Headless Raspberry Pi

In this final section, we will be showing you how to enable SSH when using a Raspberry Pi in a headless (No screen) environment.

Raspbian is built with a feature so that when it boots up, it will look for a file called ssh within the boot partition.

If the operating system finds this file, it will automatically enable SSH and delete the file.

1. On your Windows, Linux, or macOS device, insert your Raspberry Pi’s SD Card.

This SD card should already have the Raspbian operating system installed to it.

2. With the SD card connected to your device, open up the partition named “boot“.

How to Use SSH on Your Raspberry Pi (10)

3. In this partition, create a file called “ssh“.

This file does not need to contain anything. All that matters is that the name is correct.

How to Use SSH on Your Raspberry Pi (11)

4. Now, insert the SD Card back into your Raspberry Pi and turn it on.

After your Raspberry Pi has finished booting, you should now be able to SSH to your Raspberry Pi.

Connecting to Your Raspberry Pi over SSH

In this section, we will be showing you how to connect to your Raspberry Pi over SSH using Windows, Linux, or macOS.

As you will soon find out, connecting using SSH is a very straightforward and quick process.

Using SSH on Windows

In this section, we will be showing you how to connect to your Raspberry Pi over SSH on Windows.

Compared to Linux and Mac, Windows is the slightly more complicated one. The reason for this is that unlike those operating systems, Windows does not have an SSH client built-in.

To resolve this, we will be making use of a popular tool called Putty.

1. To start, you need to download and install Putty to your Windows device.

You will find the downloads you are after under the MSI (‘Windows Installer’) header.

2. Upon launching Putty, you will be greeted by the following screen.

There is a couple of boxes that need filling out on this screen.

First, you need to specify the IP address of the device you want to connect to. (1.)

Next, make sure that the port is set to 22 (2.). This is the default port number for SSH.

Once you have set the IP address and port, click the “Open” button (3.).

How to Use SSH on Your Raspberry Pi (12)

If you don’t know your Pi’s IP address, then you can follow our guide on finding it’s IP.

3. As this is the first time connecting to your Raspberry Pi, you will be warned that the SSH key is not known.

You need to click the “Yes” button to continue with the connection.

How to Use SSH on Your Raspberry Pi (13)

Upon the initial connection, you will be asked to enter the username that you are trying to connect using and also the password for that user.

If you are still using the default user and password, these will be pi and raspberry.

4. You should now have successfully connected to your Raspberry Pi over SSH from Windows.

How to Use SSH on Your Raspberry Pi (14)

Using SSH on Mac & Linux

Both macOS and Linux come with SSH tools installed out of the box. Having these tools built-in makes it incredibly simple to connect to your Raspberry Pi over SSH.

1. On your chosen operating system, begin by opening up the terminal app.

2. Now in the terminal, run the following command.

When running this command, make sure that you replace “192.168.0.115” with your Raspberry Pi’s own IP address.

ssh pi@192.168.0.115

If you would like to SSH into your Raspberry Pi using a different user, all you need to do is replace pi with your chosen username.

3. You will receive a warning about being unable to verify the authenticity of the host.

To continue, type Yes into the command line and press the ENTER key to confirm it.

4. You should now be prompted to enter the password for your pi user.

If you are still using the default password, type in raspberry and press the ENTER key.

5. You should now be successfully connected to your Raspberry Pi over SSH from your macOS or Linux device.

How to Use SSH on Your Raspberry Pi (15)

Troubleshooting SSH

If you have run into any issues with connecting using SSH, you can try using the following tips.

“I am getting a connection error”

Most connection issues with SSH or caused by one or two things.

First, make sure that your Raspberry Pi is connected to the same network as the device you are connecting from.

Secondly, make sure that you are using the correct IP address for your Raspberry Pi. If you are unsure of how to find this, we have a guide on retrieving the Pi’s IP address.

If you intend to connect to your device from outside your home network, make sure that you port forward port 22 and that you are using a password or SSH keys.

“I am getting access denied”

Access denied errors are typically caused by using an incorrect username or password.

Make sure that the user you are trying to connect with exists and that the password that you are typing in is correct.

If you are still using the default login, then the username should be pi and the password raspberry.

Hopefully, at this point in the guide, you will now have a good understanding of how to enable and connect using SSH on your Raspberry Pi.

If you have run into any issues with this guide, feel free to drop a comment below.

Recommended

How to use the substr() Function in PHP

How to Enable SSH on Ubuntu

Raspberry Pi DSLR Camera Control

Using the free Command on Linux

How to Use Remote Play on the Steam Deck

How to Enable Support for HFS on the Raspberry Pi

How to Use SSH on Your Raspberry Pi (2024)
Top Articles
Latest Posts
Article information

Author: Tish Haag

Last Updated:

Views: 6508

Rating: 4.7 / 5 (47 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Tish Haag

Birthday: 1999-11-18

Address: 30256 Tara Expressway, Kutchburgh, VT 92892-0078

Phone: +4215847628708

Job: Internal Consulting Engineer

Hobby: Roller skating, Roller skating, Kayaking, Flying, Graffiti, Ghost hunting, scrapbook

Introduction: My name is Tish Haag, I am a excited, delightful, curious, beautiful, agreeable, enchanting, fancy person who loves writing and wants to share my knowledge and understanding with you.