In this guide, we’ll show you how to enable SSH on your Raspberry Pi using both a graphical interface (for desktop versions of Raspberry Pi OS) and through the terminal for a headless setup.
🔒 What is SSH?
SSH (Secure Shell) is a network protocol that provides a secure way to access another computer over a network. It allows you to control your Raspberry Pi remotely, perform tasks, and transfer files, all while keeping the connection encrypted and secure.
🧰 What You’ll Need
- Raspberry Pi (any model)
- Raspberry Pi OS installed (Lite or Desktop version)
- MicroSD card with Raspberry Pi OS
- Monitor, keyboard, and mouse (optional for initial setup)
- Wi-Fi or Ethernet connection
- Another computer (Windows, macOS, or Linux) or smartphone for remote access
⚙️ Method 1: Enable SSH via Raspberry Pi Configuration (For Desktop Users)
If you’re running the full desktop version of Raspberry Pi OS, enabling SSH is quick and simple through the Raspberry Pi Configuration tool.
- Open the Raspberry Pi Menu in the top-left corner of the desktop.
- Go to Preferences and select Raspberry Pi Configuration.
- In the Configuration window, click on the Interfaces tab.
- Locate the SSH option and select Enable.
- Click OK to apply the changes.
Now, SSH is enabled, and you can access your Raspberry Pi remotely from another computer using an SSH client like PuTTY (Windows) or Terminal (macOS and Linux).
⚙️ Method 2: Enable SSH via Command Line (Headless Setup)
If you are setting up your Raspberry Pi without a monitor or keyboard (headless), enabling SSH can be done by creating a file called ssh
on the boot partition of your Raspberry Pi’s SD card.
- Insert the Raspberry Pi’s microSD card into your computer.
- Open the boot partition of the SD card (it will be named “boot” or similar).
- Create a new file named
ssh
(no file extension) in the root of the boot partition. - Eject the SD card from your computer and insert it into your Raspberry Pi.
- Power up the Raspberry Pi. The system will detect the presence of the
ssh
file and automatically enable SSH.
Once the Pi boots, you can connect to it remotely via SSH from another device.
📱 How to Connect to Your Raspberry Pi via SSH
To access your Raspberry Pi remotely, you’ll need to know its IP address. You can find it by connecting to your router or using a tool like Fing (a mobile app).
Once you have the IP address, follow these steps:
- Open your terminal (macOS/Linux) or an SSH client like PuTTY (Windows).
- Type the following command to connect to your Raspberry Pi:
ssh pi@
For example, if the IP address of your Raspberry Pi is 192.168.1.100, the command would be:
ssh [email protected]
When prompted, enter the default password: raspberry (unless you’ve changed it).
🔑 Change the Default Password for Security
For better security, it’s highly recommended to change the default password after enabling SSH. To change the password, simply type:
passwd
Follow the prompts to set a new password for your Raspberry Pi.
🛡 Secure Your SSH Connection
To improve security when using SSH, consider the following tips:
- Change the default password immediately after logging in
- Use SSH keys for authentication instead of passwords
- Disable SSH login for the “pi” user and create a custom user
- Use a firewall or restrict access to SSH from specific IPs