How to add socks proxy to ssh config file?

后端 未结 3 720
[愿得一人]
[愿得一人] 2021-01-31 13:27

I know how to forward SOCKS proxy on the command like below

ssh -D port_number user@host

This works well but I want to be able to put that forw

3条回答
  •  独厮守ぢ
    2021-01-31 14:15

    This is how it is done:

    Host server-fwd
    Hostname a.b.c.d
    User username
    Port 22
    LocalForward localhost:AAAA localhost:DD
    LocalForward localhost:BBBB localhost:EEE
    LocalForward localhost:CCCC localhost:FFFF
    

    Change the "server-fwd" to whatever name you like, change "a.b.c.d" to the IP you're connecting to, change "username" to whatever your account is, maybe change the port number if necessary.

    The LocalForward lines are the ones you have been looking for. The middle column (i.e. AAAA, BBBB and CCCC) are the ports on the system you are running the ssh command from. The right column (i.e. DD, EEE and FFFF) are the ports on the server you're connecting to. It's localhost in both cases because in the first case it's when the ssh command is run locally and in the second case it is relative to the server you just logged into.

    Yes, I use this a lot. ;)

提交回复
热议问题