-o option Can be used to give options in the format used in the configuration file. This is useful for specifying options for which there is no separate command-line flag. For full details of the options listed below, and their possible values, see ssh_config(5).
这里面,man ssh_config中ProxyCommand的描述为:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
ProxyCommand Specifies the command to use to connect to the server. The command string extends to the end of the line, and is executed using the user's shell ‘exec’ directive to avoid a lingering shell process.
Arguments to ProxyCommand accept the tokens described in the TOKENS section. The command can be basically anything, and should read from its standard input and write to its standard output. It should eventually connect an sshd(8) server running on some machine, or execute sshd -i somewhere. Host key management will be done using the Hostname of the host being connected (defaulting to the name typed by the user). Setting the command to none disables this option entirely. Note that CheckHostIP is not available for connects with a proxy command.
This directive is useful in conjunction with nc(1) and its proxy support. For example, the following directive would connect via an HTTP proxy at 192.0.2.0:
-X proxy_version Requests that nc should use the specified protocol when talking to the proxy server. Supported protocols are “4” (SOCKS v.4), “5” (SOCKS v.5) and “connect” (HTTPS proxy). If the protocol is not specified, SOCKS version 5 is used.
我的梯子一般使用 clash 系的代理工具,clash X 或 stash。 stash app store版用的是系统级VPN接口,理论上不需要另外为ssh设置代理。局域网内设备运行的stash需要在 Settings > Network Settings 中turn on Allow LAN Devices 选项,以开启LAN访问。 clash 系工具的混合代理监听端口 (mixed proxy port) 一般是7890,将ProxyCommand的端口修改一下即可。