如何将socks代理添加到ssh配置文件? [英] How to add socks proxy to ssh config file?

查看:26
本文介绍了如何将socks代理添加到ssh配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何通过如下命令转发 SOCKS 代理

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

ssh -D port_number user@host

这很有效,但我希望能够将该转发放入我的 SSH config 文件中.但我找不到任何有用的信息或教程.

This works well but I want to be able to put that forwarding into my SSH config file. But I am not able to locate any useful information or tutorial about.

我在配置中有一堆普通的 SSH 配置文件,所以我更喜欢将转发附加到 SSH 配置文件.

I have bunch of normal SSH profiles in the config so I prefer to have the forwardings attached to the SSH profiles.

推荐答案

使用配置设置DynamicForward" 以下是它应该是什么样子的快速示例:

Use the config setting "DynamicForward" Here is a quick example of what it should look like:

Host example.com
    User username
    Port 22
    IdentityFile ~/.ssh/id_rsa
    DynamicForward 8080

如果 DynamicForward 选项只给出一个端口号,它将绑定到 localhost:port.您可以添加特定 IP 以使其绑定到本地主机以外的地址.使用*:8080"会将代理绑定到盒子上的所有 IP 地址.要使用 IPv6 地址,请将地址括在方括号中:

If the DynamicForward option is only given a port numer it will bind to localhost:port. You can add a specific IP to get it to bind to an address other than the localhost. Using "*:8080" will bind the proxy to all IP addresses on the box. To use an IPv6 address enclose the address in square brackets:

[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:8080

这篇关于如何将socks代理添加到ssh配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆