Remotely Accessing Your Raspberry Pi with SSH

A step-by-step guide on how to connect and manage your Raspberry Pi remotely using the Secure Shell (SSH) protocol. …


Updated September 27, 2023

Need help with your Raspberry Pi?
Contact Me!

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


A step-by-step guide on how to connect and manage your Raspberry Pi remotely using the Secure Shell (SSH) protocol. SSH, or Secure Shell, is a secure method of connecting to another computer over a network. It allows users to run commands on a remote system as if they were directly logged in locally. In this article, we will cover how to SSH into Raspberry Pi from another network using both Windows and Linux-based systems.

Preparing Your Raspberry Pi

  1. Ensure that your Raspberry Pi is connected to the internet.
  2. Open the terminal and update the package list with sudo apt-get update.
  3. Install openssh-server using the command sudo apt-get install openssh-server.
  4. Enable SSH by running sudo systemctl enable ssh.
  5. Start the SSH service with sudo systemctl start ssh.
  6. Find your Raspberry Pi’s local IP address by running hostname -I in the terminal. Note this down as you will need it later.
  7. If your Raspberry Pi is behind a router, configure port forwarding to ensure that incoming SSH connections are directed to your Raspberry Pi. This varies depending on your router’s settings, so consult your router’s documentation for instructions.
  8. Set up static IP address for your Raspberry Pi if you don’t want to look up the IP every time you need to connect. Edit /etc/dhcpcd.conf using sudo nano /etc/dhcpcd.conf and add a line like this at the end of the file: interface eth0 static ip_address=192.168.1.10/24.

Connecting from Windows

  1. Open PuTTY, which you can download here.
  2. In the Host Name (or IP address) field, enter the Raspberry Pi’s local or global IP address. If you’re connecting within your network, use the local IP; if outside your network, use a static global IP or configure port forwarding on your router and enter the external IP.
  3. Set the connection type to “SSH” in the drop-down menu.
  4. Click “Open” to establish the SSH connection. If this is your first time connecting, you may be prompted to add the Raspberry Pi’s fingerprint to your known hosts list. Confirm that it matches with your device and click “Yes.”
  5. Enter your Raspberry Pi username and password when prompted. By default, the username is pi and the password is raspberry.
  6. You are now connected to your Raspberry Pi!

Connecting from Linux or macOS

  1. Open a terminal window on your computer.
  2. Run ssh pi@<ip-address> where <ip-address> is the local or global IP of your Raspberry Pi. If you’re connecting within your network, use the local IP; if outside your network, use a static global IP or configure port forwarding on your router and enter the external IP.
  3. Enter your Raspberry Pi password when prompted. By default, the username is pi and the password is raspberry.
  4. You are now connected to your Raspberry Pi!

Now that you have successfully SSH’d into your Raspberry Pi from another network, you can manage it remotely using the command line interface. This includes running commands, transferring files, and even controlling the device via a script. To disconnect from the SSH session, simply type exit or use the shortcut Ctrl+D.