devnull.land

Miscellaneous bits and bobs from the tech world

Forward port from remote server to local machine

4/21/2022, 2:23:45 PM


This is how to do it, because I have the memory of a goldfish and have to look it up every time.

The context

Let's say there's a server (123.123.123.123) running a service on port 1234.

You want to view it on your local machine on port 2345.

The command

ssh -NL 2345:localhost:1234 root@123.123.123.123

Adjust port numbers, username, remote IP, etc. as necessary.

... and then

Browse to localhost:2345.