Home » Linux » Shell » Ssh Into Raspberry Pi

How to SSH Into Your Raspberry Pi Remotely [Simple Guide]

Here’s a summary of the options available for connecting to your Raspberry Pi via SSH – from Linux, macOS, and Windows.

Networking

We’ll assume you have your Pi on your network – wired or wirelessly.

Static IP Address vs DHCP

Your Raspberry Pi will most likely be configured to receive an IP address via DHCP (Dynamic Host Configuration Protocol), which means your router assigns an available address to your Pi. As it’s assigned automatically, you won’t know what it will be in advance.

If you’ve configured your Raspberry Pi with a Static IP address or a DHCP reservation on your router – congrats! You already know what it’s IP address is (because you set it yourself).

Finding the IP Address of your Raspberry Pi

If your Pi was configured to use DHCP to receive an IP address (this is the default behavior), you’ll need to find out what it is.

With a Display & Keyboard Attached

You’ll need to know your Pis IP address on your network so that you can connect to it. To find this type:

hostname -l

…into the Linux shell on your Pi. Your IP address will be returned – it will look something like 192.168.0.100 or 10.1.0.100

Without a Display, With Network Attached

If your Raspberry Pi doesn’t have a display/keyboard attached and is connected to your network, you can still find out which IP address has been assigned to it:

From your router

If you can connect to your router and log in to the router admin interface, you can check out the DHCP table, which lists the assigned IP addresses with the type of device it was assigned to – you’ll be able to find your Pi in the list and note its IP address.

The DHCP table is sometimes otherwise displayed under client list or connected devices or wifi devices – check out your router manual to find out what label your device uses.

If you want to make sure your Raspberry Pi receives the same IP address via DHCP from your router every time it connects, you can tell your router to do so using a DHCP Reservation – again, your router manual will tell you how to do this. If you reserve an address for your Pi, you won’t need to check its address every time you want to connect.

Multicast DNS

If your network supports mDNS, you can simply connect to your Pi at the address raspberrypi.local instead of using an IP address. To check if it’s available at this address, type:

ping raspberrypi.local

into your terminal or command prompt. If the Pi is reachable at raspberrypi.local, you’ll see some success messages – or errors if it’s not.

raspberrypi.local is the default hostname of a Raspberry Pi running Raspberry Pi OS – if you set it to be something different (eg. when installing Ubuntu MATE, you can specify your own hostname) – you will need to use that instead.

Using a network scanner

If you’ve got your Android or iOS device handy, you can use the free Fing app to scan your network to get a list of devices and their IP addresses in a list.

Enabling SSH On Raspberry Pi OS

On your Raspberry Pi, with a keyboard and screen attached, login and run the following command:

sudo raspi-config

And then navigate to the menu option:

Interface Options -> SSH 

And enable SSH access.

Connecting Via SSH

Linux

SSH ships with pretty much every modern Linux distribution, so you shouldn’t need to worry about installing it. Simply open a terminal and type:

ssh [email protected]

Where:

  • pi is the username you wish to connect with
  • 192.168.0.100 is your Raspberry Pis IP Address

Windows

Not every version of Windows has an SSH client built-in, so we’ll use a neat program called PuTTY to connect:

Download it from https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Once downloaded, open PuTTY and type

[email protected]

into the Host Name (or IP address) field and click Open

Mac

Connecting on macOS is exactly the same as connecting on Linux, see above.

iOS / Android

https://termius.com provide cross-platform SSH tools for mobile – though a sign up is required. They do have extensive documentation on how to set up and use their software so that you can connect to your devices over SSH from iOS and Android.

Conclusion

Once you’ve connected to your Raspberry Pi via SSH, you can disconnect your monitor and keyboard and use it ‘headless’. This means that if you’re using your Pi as a web server, CCTV system, or music streamer you can save space by tucking it away somewhere inconspicuous.

While connected via SSH, you can do anything you’d usually do if you were controlling the Pi directly, so it can also save you constantly unplugging your monitor from your desktop computer to use your Pi – you can multitask now!

SHARE:
Photo of author
Author
I'm Brad, and I'm nearing 20 years of experience with Linux. I've worked in just about every IT role there is before taking the leap into software development. Currently, I'm building desktop and web-based solutions with NodeJS and PHP hosted on Linux infrastructure. Visit my blog or find me on Twitter to see what I'm up to.

Leave a Comment