Step-by-step instructions for setting up a SSH Server on a Raspberry Pi.
These procedures apply to Raspberry Pi 5, 4 or 3 with Raspberry Pi OS (64-Bit), (32-Bit) or (Legacy, 32-Bit).
General Notes
1. General:
The procedures below are optimized for setting up a SSH Server on a Raspberry Pi 5, 4 or 3 with Raspberry Pi OS (64-Bit), (32-Bit) or (Legacy, 32-Bit).
2. Internet access during setup:
Many of the steps below assume and require the target Raspberry Pi is connected to a network with access to the Internet.
Notice about updates, upgrades and installations failing due to repository or network congestion or outages
Occasionally updates, upgrades and installations fail due to repository or network congestion or outages.
Sometimes there is an appropriate message saying as such, sometimes a missing file is reported, and sometimes there is just a failure message without an explanation.
When this occurs, simply run the command again.
If that does not solve the issues immediately, try again later.
Via a Display, Keyboard and Mouse, then open a Terminal window.
Enable SSH
Notes:
SSH is preinstalled in Raspberry Pi OS, but is disabled by default.
However, it may have been enabled as an option in Raspberry Pi Imager during SD Card setup.
If you are uncertain, there is no danger in enabeling it here as well.
Port used by SSH: 22, Type TCP
Update Raspberry Pi OS and Components
Download the latest package lists
sudo apt update -y
Download and install the updated packages listed in the package lists
sudo apt full-upgrade -y
Enable SSH
Via Raspberry Pi Config
sudo raspi-config
Interface Options | SSH | Yes | OK | Finish | Yes
- or -
Via the Raspberry Pi GUI (Desktop)
Click on "Start" (Raspberry) On the left side of the Task Bar at the top of the Raspberry Pi desktop
Click on "Preferences"
Click on "Control Centre"
Click on the "Interfaces"
Click on the "SSH:" | On
Click on the "Close" Button
Connect to the target Raspberry Pi via SSH (Optional)
Determine the target Raspberry Pi IP Address:
Via Raspberry Pi Connect Remote shell or Raspberry Pi Connect Screen share then open a Terminal window.