-
Sign-up (email is not verified!)
-
./ngrok authtoken <your authtoken>
-
Start an online ngrok process in the background:
./ngrok tcp -region <your region e.g. in> <local port number> </dev/null &>/dev/null & # For SSH (default port: 22) and nc
-
Get the public URL and forwarded port to reach your exposed localhost at the local port number given above:
curl --silent --fail http://127.0.0.1:4040/api/tunnels | grep -o tcp://[^\"]*
The output would be in the form: tcp://URL:PORT
Do all the above. Then open two terminals side by side. In one of them do:
nc -lk <local port number>
In the other, do:
nc <URL> <forwarded port number>
Enter any text in any of the two terminals. The entered text should appear at the other terminal.
-
Start an online ngrok process at the remote host (viz. the SSH server). To make it persistent, use an infinite loop:
while :;do ./ngrok tcp 22; done </dev/null &>/dev/null &
-
In order to SSH to the remote host, simply get the URL and forwarded port from the dashboard.
-
Connect:
ssh <your username at the remote host>@<URL> -p <forwarded port number>