Control your Raspberry Pi from anywhere with ngrok! Learn how to setup remote access in just a few steps.

In this tutorial, we will show you how to remotely access and control your Raspberry Pi from any device with internet connection using the Ngrok tool. No need to worry about port forwarding or opening …


Updated September 7, 2023

Need help with your Raspberry Pi?
Contact Me!

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


In this tutorial, we will show you how to remotely access and control your Raspberry Pi from any device with internet connection using the Ngrok tool. No need to worry about port forwarding or opening up security holes in your home network!

  1. Setup Raspberry Pi Before we start, make sure you have a Raspberry Pi set up and running with an internet connection. If you haven’t done this yet, follow the official guide to get started: https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up

  2. Install Ngrok Ngrok is a tool that creates a secure tunnel between your Raspberry Pi and the internet, allowing you to access it remotely. To install ngrok on your Raspberry Pi, open a terminal window and enter the following command:

curl -sSL https://ngrok.io/install.sh | sh

This will download and install Ngrok on your Pi. Once it’s installed, you can run it by typing ngrok in the terminal.

  1. Run a Web Server To remotely access your Raspberry Pi, you need to have something running on it that you can connect to. For this example, we will use a simple web server. Open another terminal window and enter:
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install -y apache2

This will install the Apache web server on your Raspberry Pi. Once it’s installed, you can start it by running:

sudo systemctl start apache2
  1. Start Ngrok Tunnel Now that you have ngrok and a web server set up, we can create a tunnel to access the web server remotely. Run this command in your terminal:
ngrok http 80

This will create a secure tunnel between your Raspberry Pi and the internet, forwarding any requests made to the ngrok URL to your web server running on port 80 (the default HTTP port). You should see output similar to this:

Session Status                online
Account                     free
Version                     2.3.40
Region                      United States (us)
Web Interface               http://127.0.0.1:4040
Forwarding                  http://92832de05577c.ngrok.io -> http://localhost:80
Forwarding                  https://92832de05577c.ngrok.io -> http://localhost:80

Copy the https URL (in this case, https://92832de05577c.ngrok.io). You can now access your Raspberry Pi’s web server from anywhere by opening a web browser and entering that URL!

  1. Secure Your Tunnel (Optional) Ngrok provides a free plan with some limitations, including a maximum of 8 hours per day for tunnels running in the free tier. To get more time or additional features, you can sign up for an ngrok account and add your authtoken:
ngrok authtoken <your_token>

You can get a token by signing up at https://dashboard.ngrok.com/signup.

  1. Access Your Pi Remotely Now that you have everything set up, open your web browser and enter the ngrok URL to access your Raspberry Pi’s web server from anywhere! You can use this to SSH into your Pi (using a tool like PuTTY), control it with software like VNC, or even access its camera remotely.

That’s it! With just a few steps, you now have remote access to your Raspberry Pi using Ngrok. If you have any questions or encounter any issues, feel free to ask in the comments below. Happy tinkering!