DEV Community

Hedy
Hedy

Posted on

How to SSH into a Raspberry Pi?

SSH (Secure Shell) allows you to remotely access your Raspberry Pi's command line over a network.

Image description

📌 1. Enable SSH on Raspberry Pi

If SSH isn’t enabled:

  • Run the Raspberry Pi configuration tool:

`bash

sudo raspi-config`

  • Navigate to:
    Interfacing Options → SSH → Enable

  • Confirm and exit.

  • Reboot the Raspberry Pi if necessary:

`bash

sudo reboot`

🔹 Alternative Method: Place an empty file named ssh (no extension) in the boot partition of your SD card. SSH will be enabled on boot.

📌 2. Find the Raspberry Pi's IP Address

On your Raspberry Pi, run:

`bash

hostname -I`

Take note of the IP address (e.g., 192.168.1.100).

📌 3. SSH from Another Device

On your computer (Linux, macOS, or Windows with an SSH client like PowerShell or Command Prompt), run:

`bash

ssh pi@`

  • Replace with your Raspberry Pi's IP address.
  • Default username: pi
  • Default password: raspberry (if unchanged).

📌 4. Accept SSH Fingerprint

The first time you connect, you'll see:

`bash

Are you sure you want to continue connecting (yes/no)?`

Type:

`bash

yes`

Enter your password when prompted.

📌 5. SSH Using a Custom Port (if changed)

If SSH is running on a non-default port (e.g., 2222):

`bash

ssh -p 2222 pi@`

📌 6. Exit SSH Session

When you're done, exit the session with:

`bash

exit`

✅ You’re now connected to your Raspberry Pi via SSH! 🚀

Top comments (0)