Enabling SSH (Secure Shell) on a Raspberry Pi allows you to remotely access your device over the network, making it convenient to manage without a direct keyboard or monitor connection. Here's how to enable SSH on your Raspberry Pi:
Using Raspberry Pi OS Desktop
If you're using the Raspberry Pi OS desktop interface, you can enable SSH via the configuration settings:
-
Open the Raspberry Pi Configuration tool by navigating to the Raspberry Pi icon in the top-left corner, then
Preferences
, and finally Raspberry Pi Configuration
.
-
In the Raspberry Pi Configuration dialog, click on the
Interfaces
tab.
-
Find the SSH option and click
Enable
.
-
Click
OK
to apply the changes. You might need to reboot your Raspberry Pi for the changes to take effect.
Using raspi-config
on the Command Line
If you're operating your Raspberry Pi in headless mode (without a graphical interface) or you prefer using the command line, follow these steps:
-
Open a terminal on the Raspberry Pi or connect to it via SSH if it's already enabled.
-
Type
sudo raspi-config
and press Enter. This opens the Raspberry Pi Software Configuration Tool.
-
Navigate to
Interfacing Options
using the arrow keys and press Enter.
-
Scroll down to
SSH
and press Enter.
-
Select
Yes
to enable the SSH server.
-
Select
Ok
when prompted with the confirmation message.
-
Finish and exit
raspi-config
by selecting Finish
. You may choose to reboot your Raspberry Pi to ensure all settings are correctly applied.
Enabling SSH Without a Screen (Headless Setup)
If you don't have your Raspberry Pi connected to a monitor or keyboard, you can enable SSH by creating a file in the boot directory:
-
Access the
boot
partition of your Raspberry Pi's SD card on another computer. This partition should be accessible when you insert the SD card into your computer's card reader.
-
Create an empty file named
ssh
(without any extension) in the root of the boot
partition.
-
Safely eject the SD card from your computer and insert it back into your Raspberry Pi.
-
Power on your Raspberry Pi. SSH will be enabled automatically.
Connecting to Your Raspberry Pi via SSH
Once SSH is enabled, you can connect to your Raspberry Pi from another computer using an SSH client. You'll need to know the Raspberry Pi's IP address on your network.
On a computer on the same network, open a terminal (Linux or macOS) or an SSH client like PuTTY (Windows) and connect using the following command:
ssh pi@<IP_ADDRESS>
Replace <IP_ADDRESS>
with your Raspberry Pi's IP address. The default username is pi
, and the default password is raspberry
(you should change this password for security reasons).
This should give you command-line access to your Raspberry Pi, from which you can manage it remotely.