Setting up SSH on a Raspberry Pi allows one or more users to log in to the system remotely for administration or other tasks via a separate command line terminal. SSH is a client-server protocol that provides secure, encrypted connections over a network connection (could be a local network or over the internet). This allows users to SSH into the Raspberry Pi from another Linux system or other SSH client.
In this tutorial, we will look at how to enable SSH on a Raspberry Pi. There are two main ways to get this done, either by interacting directly with the Raspberry Pi and configuring SSH, or by configuring the installation settings via the Raspberry Pi imager tool, which allows us to enable SSH before actually booting into Raspberry Pi OS for the first time. Since both options cover different scenarios, we will look at both methods below.
In this tutorial you will learn:
- How to enable SSH via Raspberry Pi imaging tool
- How to enable SSH on the Raspberry Pi
|Category||Requirements, Conventions or Software Version Used|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Enabling SSH: Which Method?
There are two scenarios that you may find yourself in:
Scenario 1) You just bought a Raspberry Pi, and need to configure it so that you can SSH into the device once it is up and running. In this case, you will need to enable and configure SSH from the Raspberry Pi imager tool, so that you can start using SSH to manage your Raspberry Pi from the very first time it boots into the operating system.
Scenario 2) The operating system has already been installed on your Raspberry Pi, and you have been using it as normal. Now, you want to enable SSH so that you can continue to log in and administer the device from over the network. In this case, we can just install, enable, and configure SSH from the command line on the Raspberry Pi.
Depending on which situation you are in, will determine the set of instructions you should follow below.
Enable SSH via Raspberry Pi Imaging Tool
For this section, it is assumed that you do not yet have the Raspberry Pi OS installed on your device, and you wish to configure the SSH settings so that you are able to log in to the Raspberry Pi via SSH when it is booted up for the first time.
- You can download the Raspberry Pi imaging tool from by navigating to the Raspberry Pi’s website and going to the Raspberry Pi OS download page. On this page, we need to download the Raspberry Pi imaging tool. Be sure to select the one that corresponds to your current operating system – either Linux, Windows, or MacOS.
- After opening the Raspberry Pi imager tool and selecting the Raspberry Pi OS for installation, you will see a cog wheel icon appear on the tool. This allows us to configure essential settings such as SSH for our installation. During installation, we will not go through traditional prompts as is usual on Linux installs, but rather we preconfigure all the settings in the imaging tool.
- Inside of the settings menu, you will see the option to enable SSH. You can also select whether to authenticate with SSH via username and password, or using public key authentication (See: Setting up SSH key authentication).
Remember to also configure a username and password when enabling SSH.
SSH passwords are commonly compromised due to brute force attacks. Make sure that you use a complex and non-dictionary password for all users on the Raspberry Pi system that you plan to enable SSH login for.
Enable SSH on Raspberry Pi
This next method assumes that you already have your Raspberry Pi up and running, have an established connection to it (such as physically via keyboard and monitor), and wish to now enable SSH on the device.
- The easiest way to enable SSH on an existing Raspberry Pi OS installation is via the
raspi-configutility. Get started by opening a command line terminal and executing the following command:
- Select the third option for ‘Interface Options.’
- Then, select the option to enable SSH. There will be one more prompt to make sure that you really want to enable it.
In this tutorial, we saw how to enable SSH on a Raspberry Pi. The SSH protocol allows users to log into and administer their Raspberry Pi from another computer on the network or from over the internet. As a matter of fact, users can configure SSH before ever booting up their Raspberry Pi, ensuring that it is ready to use SSH from the moment it first boots up.