I want to access all ports from my VPS on my local machine. I know that I can do ssh -f myusername@vps -L 1000:vps:1000 -N to access one port - but can I do that in an easy way (without knowing which ports are on the vps beforehand) that I can type in my local browser vps.localhost:1000 to access the port 1000 on the VPS? So I need something like ssh -f myusername@vps -L vps.localhost:vps:* -N. Basically I want to access localhost from the vps through vps.localhost on my local machine.

I'm not sure if my question has been asked before - if so please tell me and I'm happy too, I could only find question which asked the opposite of mine, to tunnel all local traffic through the VPS.

  • Perhaps you want to use the dynamic proxy option to ssh? ssh -D 1234 user@remote and then configure your browser, mail client, etc to use localhost:1234 as the proxy, or set it system wide... – ivanivan Jul 30 '17 at 1:42

Use the -D [port] option. Set your application to use [port] as a SOCKS5 proxy (might be a bit hard if the application doesn't support that. Firefox definitely does). Now you can browse to for example, and you'll end up on the remote box's application listening on port 9001.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.