Multiple SSH Port Forwardings
This post by Dillon Hafer is one of my favorite remote-work tricks. Today I learned more about this part of the SSH configuration.
Multiple forwardings can be set; in a setup where port 3000
and port 9000
are important, we can forward both:
# ~/.ssh/config
Host example
Hostname example.com
LocalForward 3000 localhost:3000
LocalForward 9000 localhost:9000
Ports 3000
and 9000
will then be forwarded from the remote host. For a one-time solution, we can also add more via the command line:
$ ssh example -L 4000:localhost:4000
Combining this command and the configuration file above, ports 3000
, 9000
, and 4000
will be forwarded.