Accessing Your Raspberry Pi From Anywhere, Even If It’s Not Near You

Learn how to connect to your Raspberry Pi remotely so you can access and control it from anywhere in the world. …


Updated August 9, 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 connect to your Raspberry Pi remotely so you can access and control it from anywhere in the world.

There are several ways to connect to your Raspberry Pi remotely depending on your needs and preferences. In this article, we will cover two of the most common methods: SSH (Secure Shell) and VNC (Virtual Network Computing). Both of these methods allow you to access your Pi’s graphical interface from another device, such as a laptop or smartphone, even if it is not physically near you.

Method 1: Connecting via SSH (Secure Shell)

SSH is the most common and secure way to remotely access your Raspberry Pi. It allows you to run commands on your Pi just like if you were sitting in front of it, but from a remote location. To do this, you will need to enable SSH on your Pi and set up port forwarding on your router. Here’s how:

  1. Enable SSH on your Raspberry Pi:

    • Open the terminal on your Pi and type sudo raspi-config and hit Enter.
    • Navigate to “Interfacing Options” and select “SSH.”
    • Choose “Yes” when prompted to enable SSH, then select “Finish” to save and exit.
  2. Find your Pi’s local IP address:

    • Open the terminal on your Pi again and type ifconfig and hit Enter.
    • Look for the inet addr: under the wlan0 or eth0 section (depending on whether you are using Wi-Fi or Ethernet) to find your local IP address. It should look something like 192.168.x.x.
  3. Set up port forwarding on your router:

    • Log in to your router’s admin panel by entering its IP address (usually 192.168.0.1 or 192.168.1.1) into a web browser and following the instructions provided by your router manufacturer.
    • Find the section for port forwarding and add a new rule. Set the external (WAN) port to 22, the internal (LAN) IP address to your Pi’s local IP address from step 2, and the internal port to 22 as well.
  4. Connect to your Raspberry Pi remotely:

    • On your remote device (laptop or smartphone), download an SSH client app if you haven’t already. For example, on Android you can use JuiceSSH or Termius, and on iOS you can use iSH or Prompt.
    • Enter your router’s public IP address (you can find this by searching “what is my IP” online) and the external port you set up in step 3 (22).
    • Log in with the default username pi and password raspberry. If you have changed the default password, use that instead.

Now you are connected to your Raspberry Pi remotely via SSH! You can run commands just like if you were sitting at its keyboard. To exit SSH, type exit or press Ctrl+D.

Method 2: Connecting via VNC (Virtual Network Computing)

VNC allows you to see and control your Raspberry Pi’s graphical interface from a remote device. This is useful if you want to use graphical programs like Scratch or Minecraft, but it may be slower than SSH for running terminal commands. To set up VNC, follow these steps:

  1. Install RealVNC on your Raspberry Pi:

    • Open the terminal and type sudo apt-get update to make sure you have the latest package list.
    • Then type sudo apt-get install realvnc-vnc-server and follow the prompts to install the server.
  2. Configure your router for VNC:

    • Set up port forwarding on your router just like in method 1, but use port 59000 this time instead of 22.
  3. Connect to your Raspberry Pi remotely:

    • On your remote device, download a VNC client app if you haven’t already. For Android, you can use bVNC or Remote Desktop Viewer, and for iOS, you can use RealVNC or iVNC Viewer.
    • Enter your router’s public IP address and the port you set up in step 2 (59000). You may be prompted to enter a password; if so, type raspberry or your own VNC password if you have changed it.

Now you can see and control your Raspberry Pi’s graphical interface from anywhere! To disconnect, simply close the VNC client app.

Conclusion: Both SSH and VNC are great ways to connect remotely to your Raspberry Pi, but they have different use cases. SSH is faster and more secure for running commands, while VNC is better suited for graphical programs. Choose the method that best fits your needs and start exploring the world of remote computing with your Raspberry Pi!