Ngrok in Termux: Expose your LocalHost

Ngrok is a popular reverse proxy tool that allows users to create secure tunnels from a public endpoint to a web service running locally. It enables users to expose a port on their local system to a public URL, redirecting external connections to their local host. Ngrok has several use cases, including sharing a website running on a private network with colleagues, creating a TCP server on a device, port forwarding, testing mobile apps connected to locally running backends, providing stable addresses for devices deployed in the field, and running personal cloud services from home. It can also be used in ethical hacking, allowing users to remotely take the reverse shell and reverse the connection of any device through TCP tunneling with Ngrok.

In this article, we will guide you through the steps to install Ngrok in Termux, a popular terminal emulator for Android. Before diving into the installation process, let’s define Ngrok in more detail.

What is Ngrok?

Ngrok is a reverse proxy that creates a secure “tunnel” from a public endpoint for a web service running locally.

How does Ngrok work?

Let’s assume you have a web server running on your machine. Now you intend to share, with a colleague, the address of a website that you developed, but as it is on a private network. To do this, use Ngrok. Considering that the web server is at port 8080, you only need to execute the following command:

$ ngrok http 8080

How to install Ngrok in Termux?

Here is a step-by-step guide to installing Ngrok in Termux:

  1. Open Termux and update and upgrade the repositories using the following command: pkg update && pkg upgrade -y
  2. Install the zip and wget packages in Termux using the following order: pkg install zip wget -y
  3. Download Ngrok in Termux using the following command: wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip
  4. Unzip the Ngrok folder using the following command: unzip ngrok-stable-linux-arm.zip
  5. Grant Ngrok permission to read, write, and execute using the following command: chmod +x ngrok
  6. Sign up for a new account on the Ngrok website and confirm your account through the email sent to you.
  7. Log in to Ngrok with your email and password and search for the auth token on the Ngrok page. Then, type the following command in Termux, replacing <YOUR_AUTH_TOKEN> with your auth token: ./ngrok authtoken YOUR_AUTH_TOKEN_HERE
  8. Ngrok is now successfully installed in Termux. To learn how to use Ngrok in Termux, use the following command: ./ngrok help

Note: If you experience Ngrok reconnecting issues, open your mobile hotspot and start Ngrok again.

Conclusion

In conclusion, Ngrok is a useful tool that enables users to expose a local web service to a public URL. With the help of Termux, installing Ngrok becomes an easy and straightforward process. We hope this guide has been helpful to you in installing Ngrok in Termux.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top