How to Enable SSH on Raspberry Pi Quickly and Easily
To enable
ssh on a Raspberry Pi, create an empty file named ssh (with no extension) in the boot directory of the SD card before booting the Pi. Alternatively, enable ssh via raspi-config after booting by selecting Interfacing Options > SSH and choosing Enable.Syntax
There are two main ways to enable SSH on Raspberry Pi:
- Create an empty file named
sshin the boot partition of the SD card before first boot. - Use the
raspi-configtool after booting to enable SSH.
These methods activate the SSH server so you can connect remotely.
bash
touch /boot/ssh sudo raspi-config # Navigate to Interfacing Options > SSH > Enable
Example
This example shows how to enable SSH by creating the ssh file on the SD card's boot partition using a computer before inserting it into the Raspberry Pi.
bash
# On your computer, after flashing Raspberry Pi OS to the SD card:
touch /path/to/boot/ssh
# Then insert the SD card into the Raspberry Pi and power it on.
# Alternatively, after booting the Pi:
sudo raspi-config
# Select Interfacing Options > SSH > Enable
# Exit and reboot if promptedOutput
SSH server enabled
You can now connect to your Raspberry Pi using ssh pi@<ip-address>
Common Pitfalls
Common mistakes when enabling SSH on Raspberry Pi include:
- Not creating the
sshfile in the correct boot partition before first boot. - Using a file named
ssh.txtor with an extension, which will not work. - Forgetting to enable SSH in
raspi-configif using that method. - Not knowing the Raspberry Pi's IP address to connect via SSH.
- Network issues blocking SSH connections.
Always ensure the ssh file has no extension and is placed in the boot partition accessible by your computer.
bash
Wrong way: touch /boot/ssh.txt # This will NOT enable SSH Right way: touch /boot/ssh # Correct file name with no extension
Quick Reference
| Step | Action |
|---|---|
| 1 | Flash Raspberry Pi OS to SD card |
| 2 | Create empty file named 'ssh' in boot partition (no extension) |
| 3 | Insert SD card into Raspberry Pi and power on |
| 4 | Find Raspberry Pi IP address on your network |
| 5 | Connect via SSH: ssh pi@ |
| Alternative | Enable SSH after boot with sudo raspi-config > Interfacing Options > SSH > Enable |
Key Takeaways
Create an empty file named 'ssh' in the boot partition before first boot to enable SSH.
Use 'sudo raspi-config' to enable SSH after booting if preferred.
Ensure the 'ssh' file has no extension; 'ssh.txt' will not work.
Know your Raspberry Pi's IP address to connect via SSH.
Check network settings if SSH connection fails.