Linux Commands


Ngrok is a cross-platform tool that uses cloud services to expose local networked services behind NATs and firewalls over a secure tunnel. Ngrok can also share local websites, build/test webhook consumers, and self-host personal services. Ngrok was created in 2012 by Alan Shreve (@inconshreveable). It operates a free and a paid version.

This article will show easy steps to set up and use ngrok.


Sign Up for ngrok here and download it. Unzip your files and run ngrok. You can also install ngrok via snap using:

$ snap install ngrok


Add your auth token. It is available in the left pane of the dashboard. One can either edit the ngrok.yml commonly stored in ~/.ngrok2/ngrok.yml.

# Add Authtoken in ngrok.yml

authtoken: 1lyypJPNKyYFnxgnbvbsds4S0iQ_5rVHeA7zsUeZ1Sntmpd9H

or simply type:

$ ngrok authtoken <your_authtoken>

This will add your auth token to the ngrok.yml configuration file. By adding authtoken, ngrok grants, you accessed additional features and increased session times.


Let’s run ngrok with HTTP. A local port number is needed for this. The following command will secure a public URL for the port 80 webservers.

$ ngrok http 80
ngrok by @inconshreveable                                                               (Ctrl+C to quit)
Session Status              online                                                                                              
Account                     Arslan Aslam (Plan: Free)                                                                          Version                      2.3.35                                                                                              
Region                      United States (us)                                                                                  
Web Interface                                                                                     
Forwarding         -> http://localhost:80                                                  
Forwarding         -> http://localhost:80                                                
                                                                                                                              Connections                   ttl     opn     rt1     rt5     p50     p90  
                            0       0       0.00    0.00    0.00    0.00

Let’s break this down. After showing online status, it identifies the user and the version installed, identifies the region. Then Ngrok informs that the web interface for ngrok is on localhost port 4040. The two URLs shown in the next line are the public addresses through which your local site can now be accessed. Note there are two URLs, one with http and the other with an https connection.

Let’s explore the status page.

As the forwarded address (something like this is accessed, Ngrok will log requests in the CLI and the web interface

HTTP Requests
GET /favicon.ico            404 File not found
GET /                       200 OK

Suppose you have a website that you need to test, and it is working on port 1337 of your localhost. We’ll use the following command:

$ ngrok http 1337

This will tunnel all the http traffic from the ngrok address to port 1337 of your device.

Using the paid plan, custom subdomains can be set using:

$ ngrok http -subdomain=arslan 80

This will tunnel port 80 traffic to

Also, Tunnel TCP traffic on port <port_number> by using:

$ ngrok tcp <port_number>

Ngrok can be updated using:

$ ngrok update


Ngrok is a capable tool and can be very helpful in Testing websites. It may not be a good idea to host your live site on your PC, so using ngrok for live sites is discouraged. Ngrok has made site testing easy, efficient, and straightforward.

Happy Testing !!!

About the author

Arslan Aslam

A security enthusiast who aspires to learn more about computers with every passing byte. From Pakistan. Tweets at @Arslanoob.