serhii.net

In the middle of the desert you can say anything you want

16 Dec 2021

Port forwarding through ssh config

  • ssh -L 6006:127.0.0.1:6006 servername -p 1234 maps port 6006 of servername to localhost:6006, using ssh that’s running there on port 1234
  • multiple ports are possible by passing multiple -L arguments

If you do it often, you can add these settings to ~/.ssh/config:

 Host pf
 Hostname servername
 LocalForward 6007 localhost:6007
 LocalForward 6006 localhost:6006
 Port 1234   

…and then you connect to it as ssh pf.

Nel mezzo del deserto posso dire tutto quello che voglio.