FeaturedLinuxRaspberry PiSSHTutorials

How to SSH into Raspberry Pi: Enable SSH, Find the IP & Connect

7 Mins read

A Practical Guide to Secure Raspberry Pi Remote Access

Pi-oneer in Remote Access: SSH into Your Raspberry Pi

Want to manage a Raspberry Pi without plugging in a monitor, keyboard, and mouse? SSH (Secure Shell) gives you encrypted command-line access from another computer on your network. It is useful for maintaining a home server, configuring a project, or working with a headless Pi from across the room.

The basic process is simple: enable SSH on the Pi, find its IP address or hostname, then connect with an SSH client. This guide walks through setup, key-based authentication, remote access, and practical fixes for common errors. If you need a screen for initial setup, see our Pi monitor setup guide.

What SSH Does on a Raspberry Pi

SSH creates an encrypted connection between your Raspberry Pi and a client computer. The Pi runs an SSH server; Windows, macOS, or Linux runs the client. Once connected, you can run commands, install packages, manage services, and inspect the system remotely.

SSH normally uses TCP port 22. Encryption protects data in transit, but it does not automatically secure a device: strong authentication, software updates, and sensible network access controls still matter.

Before You Connect

Make sure you have Raspberry Pi OS or another compatible Linux system installed, a working network connection, an account username, and an SSH client. Windows 10 and 11 generally include OpenSSH in PowerShell or Windows Terminal; macOS and most Linux distributions include it as well.

Modern Raspberry Pi OS setup asks you to create a username. Do not assume the username is pi or that there is a universal default password.

How to Enable SSH on Raspberry Pi

SSH is disabled by default on Raspberry Pi OS. Enable it during installation or on an existing system using one of the methods below.

Enable SSH with Raspberry Pi Imager

For a fresh installation, Raspberry Pi Imager is a convenient way to configure SSH and network settings before the first boot.

  1. Open Raspberry Pi Imager, select your Raspberry Pi model, operating system, and storage device.
  2. Open the OS customization settings when prompted or available.
  3. Set a hostname, create a username and password, and configure Wi-Fi details if needed.
  4. In the remote-access or services settings, enable SSH.
  5. Choose password authentication or provide your computer’s public key.
  6. Save the settings, write the image, then insert the storage device and power on the Pi.

Imager’s labels and layout can change between releases, so follow the current options on screen.

Enable SSH from the Raspberry Pi desktop

  1. Open the Raspberry Pi menu and launch Control Centre from Preferences.
  2. Choose the Interfaces tab.
  3. Set SSH to Enabled.

Enable SSH with raspi-config or the terminal

If you can use the Pi’s terminal, launch the configuration utility:

sudo raspi-config

Choose Interface Options, select SSH, and confirm that you want to enable it. Menu numbering may differ by release.

You can also start and enable the SSH service directly:

sudo systemctl enable --now ssh
sudo systemctl status ssh

Check that the service is active. If the server package is missing, install it with:

sudo apt update
sudo apt install openssh-server

Find Your Raspberry Pi’s IP Address or Hostname

Check the Pi itself or your router

With terminal access to the Raspberry Pi, run:

hostname -I

The output may show one or more network addresses. You can also sign in to your router and look under Connected Devices or DHCP Clients for the Pi’s hostname and assigned IP address.

Try the local hostname

Raspberry Pi OS commonly supports local hostname discovery through mDNS. Try the default hostname from a computer on the same network:

ping raspberrypi.local

If you chose a different hostname during setup, use that name with .local. mDNS availability varies by network and operating system; guest Wi-Fi, client isolation, VPNs, and firewalls may interfere. If name resolution fails, use the IP address instead.

SSH into Raspberry Pi from Windows, macOS, or Linux

Open PowerShell or Windows Terminal, Terminal on macOS, or a terminal on Linux. Connect using the username and IP address you configured:

ssh username@192.168.1.100

Or connect using the hostname:

ssh username@raspberrypi.local

Replace username and the example address with your own values. When connecting for the first time, SSH displays the server’s host-key fingerprint. Verify the device if possible before accepting it, then enter your account password if prompted.

Windows users who prefer a graphical client can use PuTTY. Enter the Pi’s hostname or IP address, select SSH, and use port 22 unless you changed it. Verify the host key before accepting it.

Set Up SSH Keys

SSH keys let your computer authenticate without sending your Raspberry Pi account password each time. Your private key stays on your computer; the matching public key is installed on the Pi. Protect the private key with a strong passphrase.

Generate an Ed25519 key pair

Run this on your client computer:

ssh-keygen -t ed25519 -C "raspberry-pi"

Accept the suggested location or choose another, then set a passphrase. The private key is usually ~/.ssh/id_ed25519; the public key is ~/.ssh/id_ed25519.pub. Never share or copy the private key to the Pi.

Install the public key

On macOS or Linux, if available, use ssh-copy-id:

ssh-copy-id username@192.168.1.100

For a manual setup, display the public key on your client:

cat ~/.ssh/id_ed25519.pub

Connect to the Pi using your current login method. On the Pi, create the SSH directory and authorized-keys file, paste the complete public key on one line, then set restrictive permissions:

mkdir -p ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

From Windows PowerShell, display the public key with:

Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub

Test the key by opening a new connection:

ssh username@192.168.1.100

If you set a key passphrase, SSH may ask for it. That is separate from the Raspberry Pi account password.

Set Up a Headless Raspberry Pi

A headless Pi runs without a dedicated display or input devices. Configure it using Raspberry Pi Imager before the first boot: choose the OS and storage, set a hostname and user account, enter Wi-Fi details if needed, enable SSH, and select password or public-key authentication. Write the image, put the storage device in the Pi, and power it on.

Once the Pi has joined the network, look up its address in your router or try its hostname with .local, then connect with SSH. If it does not appear, check the Wi-Fi name and password, wireless country setting, supported Wi-Fi band, and router isolation settings. Ethernet is a useful way to rule out Wi-Fi configuration problems.

For projects that need a screen, consult our Pi monitor setup guide. Once connected, you can explore Raspberry Pi programming or use a headless device for projects such as a Pi crypto miner.

Access the Pi Away from Home

A private address such as 192.168.1.100 normally works only on the local network. To connect from elsewhere, create a secure network path rather than assuming that the local IP is reachable over the internet.

  • Tailscale: Connects authorized devices through a private encrypted network. Install and authenticate it on the Pi and your client, then SSH to the Pi’s Tailscale address or configured MagicDNS name.
  • WireGuard: A VPN option that gives you more control but requires configuration of peers, keys, routes, and firewall rules.
  • Port forwarding: Sends incoming router traffic to the Pi, but exposes SSH to internet scanning and attack attempts.

For most home users, a VPN or private networking service is preferable to forwarding SSH directly to the internet. If direct exposure is necessary, use key authentication, keep the system updated, restrict network access where possible, and monitor logs. Changing the SSH port does not replace these protections.

Improve SSH Security

  • Use a strong, unique account password if password authentication is enabled.
  • Prefer public-key authentication and protect private keys with a passphrase.
  • Use a regular account and sudo for administration rather than logging in as root.
  • Keep Raspberry Pi OS and installed packages updated.
  • Do not disable password login until you have successfully tested key-based access in a separate session.

To disable password login, first confirm that key authentication works. Review the SSH server configuration and ensure the effective settings permit keys and disallow password authentication. Validate the configuration before reloading:

sudo sshd -t
sudo systemctl reload ssh

Keep your current session open while testing a new one to avoid locking yourself out. Configuration may also come from included files, so check the effective settings if your changes do not take effect.

Common Raspberry Pi SSH Errors and Fixes

“Connection refused”

The Pi may be reachable, but no SSH service is accepting connections on the requested port. Check that SSH is enabled and running, and confirm that you are using the correct port:

sudo systemctl status ssh
sudo systemctl start ssh

“Connection timed out” or “No route to host”

Check that the Pi is powered on, connected to the network, and using the IP address you expect. Confirm that the client and Pi can communicate and that a VPN or firewall is not blocking the route. On the Pi, inspect network details with ip addr.

“Permission denied (publickey)”

Confirm you are using the correct username and that the public key is in that user’s ~/.ssh/authorized_keys file on the Pi. Check directory and file permissions, and specify the intended key if necessary:

ssh -i ~/.ssh/id_ed25519 username@192.168.1.100

“Could not resolve hostname”

Check the hostname spelling and whether both devices are on the same network. If raspberrypi.local does not resolve, try the Pi’s numeric IP address.

“REMOTE HOST IDENTIFICATION HAS CHANGED”

This warning can appear after reinstalling the OS, regenerating host keys, or assigning an address to a different device. It can also signal a security risk, so verify the Pi’s identity before changing the saved key. After confirming the new fingerprint through a trusted method, remove the stale entry on your client:

ssh-keygen -R 192.168.1.100

Connect again and verify the new fingerprint before accepting it.

Get more diagnostic information

Verbose output can help identify connection and authentication problems:

ssh -v username@raspberrypi.local

On the Pi, check recent SSH service logs with:

sudo journalctl -u ssh -n 50

Frequently Asked Questions

Is SSH enabled by default on Raspberry Pi OS?

No. Enable it through Raspberry Pi Imager, desktop settings, raspi-config, or the system service controls.

What is the default Raspberry Pi SSH username?

Current Raspberry Pi OS setup generally asks you to create a username. There is no universal default username or password to rely on.

Can I SSH into a Raspberry Pi without a monitor?

Yes. Configure the account, network, and SSH in Raspberry Pi Imager, then find the device on your network and connect from another computer.

Can I SSH into my Raspberry Pi from outside my home?

Yes, if you set up a secure route such as a VPN or private network. Avoid exposing SSH directly to the public internet unless you understand and can manage the risks.

Conclusion

To SSH into a Raspberry Pi, enable the SSH server, find the Pi’s hostname or IP address, and connect from Windows, macOS, or Linux using your configured username. For a headless setup, configure networking and SSH before the first boot with Raspberry Pi Imager.

For safer ongoing access, use public-key authentication, protect your private key, keep the system updated, and prefer a VPN or private network for connections from outside your home. With these basics in place, SSH makes it straightforward to manage Raspberry Pi projects without keeping a monitor attached.

Leave a Reply

Your email address will not be published. Required fields are marked *