4 ms·
In case you want to access localhost on a server you're working remotely on, and would rather show localhost to your local machine than the world: $ ssh -N <us
by krenoten 14y ago
In case you want to access localhost on a server you're working remotely on, and would rather show localhost to your local machine than the world:
$ ssh -N <user>@<yourserver> -L <localport>/localhost/<serverport>
so if I'm bob at bobsbookwonderland.com, and I run a test server there on its localhost 5000 that I want to access from home, I'd type (from home):
$ ssh -N bob@bobsbookwonderland.com -L 5000/localhost/5000
and then on my local machine I'd just point my web browser to localhost:5000 as if I were running the test server locally.
- veyron 14y agoThe right way to do it is: $ ssh -N -L <localport>:localhost:<serverport> <user>@<yourserver> and $ ssh -N -L 5000:localhost:5000 bob@bobsbookwonderland.com (the : is standard syntax used on platforms, including OSX and PuTTY, and some platforms don't support getopt arguments after the first non-flag argument)
- shabble 14y agoAnother useful setting is -g Allows remote hosts to connect to local forwarded ports. if you want to allow non-local connections.