ssh_config 的选项启用顺序

连接无线网络之后,需要从 ucpu0 主机做 ssh forward 连接代理才能访问外部网络。于是我在我的  ~/.ssh/config 里做了如下设置:

Host *
	ProxyCommand connect-proxy -R both -4 -S localhost:8888 %h %p

以便 ssh 到任何其他主机都可以走本地 connect-proxy 工具打开的端口 8888 连接远程主机。

 

默认习惯,我的 .ssh/config 的顺序是 * 最前,然后是单个主机设置:

Host * ProxyCommand connect-proxy -R both -4 -S localhost:8888 %h %p Host ucpu0 User ygao6590 HostName ucpu0.ug.it.usyd.edu.au ServerAliveInterval 30 ProxyCommand none Host uc HostName ubuntu.unix-center.net 

 

结果发现我 ssh ucpu0 连接不通了,错误是代理主机无法连接。随后尝试 ssh -o "ProxyCommand none" 是没有问题的。很明显,ssh_config 里的 ProxyCommand none 没有起作用。随后我把 Host * 段落放到 Host ucpu0 之后,就没有问题了。
这是什么情况?

 

connect-proxy 程序:http://www.bartbusschots.ie/blog/?p=184

理论上系统自带的 nc 就可以搞定了。

你可能感兴趣的:(ssh_config 的选项启用顺序)