Access Your Raspberry Pi Anywhere, Anytime with SSH

Learn how to remotely connect to your Raspberry Pi from any device using SSH. Setup and configure it in a few simple steps. …


Updated August 19, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


Learn how to remotely connect to your Raspberry Pi from any device using SSH. Setup and configure it in a few simple steps.

Before we start, make sure you have the following things ready:

  • A Raspberry Pi with an active internet connection (either wired or wireless).
  • The IP address of your Raspberry Pi (you can find this by running hostname -I in the terminal).
  • An SSH client on your computer. If you’re using Windows, you can use PuTTY. For macOS and Linux, you can use the built-in Terminal.

Step 1: Enable SSH on Raspberry Pi

By default, SSH is disabled on a new installation of Raspbian (the official Raspberry Pi OS). To enable it, follow these steps:

  1. Open the terminal and type sudo raspi-config.
  2. Navigate to Interfacing Options > SSH and select Enable/Disable SSH.
  3. Choose Yes when prompted to confirm enabling the service.
  4. Reboot your Raspberry Pi by typing sudo reboot in the terminal.

Step 2: Set Up a Static IP Address (Optional)

If you want to connect to your Raspberry Pi from anywhere, it’s best to set up a static IP address for it. This way, you don’t have to look up its IP address every time you want to connect. To do this, follow these steps:

  1. Open the terminal and type sudo nano /etc/dhcpcd.conf.
  2. Add the following lines at the bottom of the file:
interface eth0
static ip_address=YOUR_IP_ADDRESS/24
static routers=YOUR_ROUTER_IP_ADDRESS
static domain_name_servers=8.8.8.8.8 8.8.4.4

Replace YOUR_IP_ADDRESS with your desired IP address (e.g., 192.168.1.10) and YOUR_ROUTER_IP_ADDRESS with your router’s IP address (usually something like 192.168.1.1). 3. Press Ctrl + X to exit the editor, then Y to save changes. 4. Restart the networking service by running sudo systemctl restart dhcpcd. 5. Reboot your Raspberry Pi with sudo reboot.

Step 3: Connect to Your Raspberry Pi from Another Device

Now that SSH is enabled and you have a static IP address (if desired), it’s time to connect remotely. Here are the steps for Windows, macOS, and Linux:

For Windows Users:

  1. Download PuTTY from here.
  2. Open PuTTY and enter your Raspberry Pi’s IP address in the Host Name (or IP address) field.
  3. Click Open to connect. You will be prompted for the username and password (default is pi).
  4. If you see a security alert, click Yes to continue.
  5. You are now connected to your Raspberry Pi!

For macOS and Linux Users:

  1. Open the Terminal application.
  2. Type ssh pi@YOUR_RASPBERRY_PI_IP and press Enter. Replace YOUR_RASPBERRY_PI_IP with your Raspberry Pi’s IP address or hostname.
  3. When prompted, enter the password (default is raspberry).
  4. You are now connected to your Raspberry Pi!

Congratulations!

You have successfully remotely connected to your Raspberry Pi from another device using SSH. Now you can run commands, transfer files, and even use graphical programs through a remote desktop protocol like VNC or X11 forwarding. Have fun exploring the world of remote computing with your Raspberry Pi!