Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to ssh into remote Linux by ngrok

Tags:

linux

ssh

tcp

ngrok

The remote Linux computer is in an internal network and has no public IP address. So I installed ngrok.

ngrok tcp 22

ngrok by @inconshreveable (Ctrl+C to quit) Tunnel Status online
Version 2.0.19/2.0.17
Web Interface http://127.0.0.1:4040
Forwarding tcp://0.tcp.ngrok.io:36428 -> localhost:22
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00

I checked that sshd is running.

At the local PC, I tried

ssh [email protected] -p36428

which gave rise to

ssh: connect to host ngrok.com port 36428: Connection refused

like image 693
ddzzbbwwmm Avatar asked Jun 01 '15 15:06

ddzzbbwwmm


People also ask

Can I use Ngrok for SSH?

ngrok's TCP tunnels are perfect for SSH traffic. Simply start a TCP tunnel to port 22 and you should be all set.

How does TCP connect to Ngrok?

To do this, first, log in to your ngrok.com dashboard and click "Reserve Address" in the "Reserved TCP Addresses" section. Then use the --remote-addr option when invoking ngrok to bind a tunnel on your reserved TCP address. Make sure the --region you specify matches the region in which you reserved your address.

Does Ngrok require port forwarding?

Your localhost development server is mapped to an ngrok.io sub-domain, which a remote user can then access. There's no need to expose ports, set up forwarding, or make other network changes. The ngrok client software is available for Windows, macOS, and Linux.


1 Answers

You are connecting to the wrong destination address. The command should be

ssh [email protected] -p36428

Notice the different hostname (ie 0.tcp.ngrok.io instead of ngrok.com).

And generally you would want to put the user@hostname after all the options (eg -p36428), even though it doesn't generally cause any issues.

like image 175
lsowen Avatar answered Oct 17 '22 12:10

lsowen