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)