Hello, guys 🤓, have you ever tried sshing into your system from the internet but you seem constrained with the fact that sshing into your system can only be done using your local network? Well, I have been there and I thought there wasn’t a solution for me until I got to discover an awesome product called Ngrok.
So before I continue, I would like to share my story on how I got to discover this awesome product. Recently I have been playing around with Ssh, I wanted to see if I could use my local system as a web server on the public internet. It seemed to work well only within devices connected to my router which you can call a local network.
Next, I wanted to connect into my system using my internet via ssh and http but I wasn’t successful with that. I got to know about port forwarding of your private IP to your routers IP. I tried it out but to no avail.
After some research, I came across Ngrok. Ngrok exposes your system to the public internet via secured tunnels.
To use it all I had to do was to download the Ngrok client, authenticate using the token copied from my dashboard on Ngrok’s website and run a simple command to expose my ssh TCP server.
ngrok tcp 22
And immediately it fires up its client displaying the required connection details. The good thing about Ngrok is that it creates an SSL domain for you for free 😲. Well, I tried Ngrok using their free plan so the assigned domain for me only lasts temporarily for a connection session. I would need to purchase their premium plan to have a static domain.
Finally, I tried Sshing into my system from my phone using the Termux app and also from an Azure server and it worked like a charm.
Below is what the ssh command I ran looks like.
ssh myusername@2.tcp.ngrok.io -p11622
Ngrok is awesome for home automation and tons of other stuff which you can find here.
So you’ve come to the end of my post. If you enjoyed it please do leave a like, and share 🤗