SSH port forwarding in ~ / .ssh / config?

So, I usually run this command a lot:

ssh -L 5901: myUser@computer.myHost.edu: 5901

I use it for VNC via SSH.

How to convert this command to something that will work in the ~ / .ssh / config file?

ex:

host yam HostName yam.myHost.edu User myUserName 

all i want to do is type:

 ssh yam 

And let it open an SSH shell with a local listening port and a remote port redirected to it.

Suggestions?

+56
linux unix ssh macos
Feb 05 2018-12-12T00:
source share
2 answers

You can use the LocalForward directive in the host yam ~/.ssh/config section:

 LocalForward 5901 computer.myHost.edu:5901 
+79
Feb 05 2018-12-12T00
source share

This article appeared recently in Hacker News and contains a record of this: http://matt.might.net/articles/ssh-hacks/

+9
Feb 05 2018-12-12T00:
source share



All Articles