当 ssh 对他们来说太旧时,有条件地跳过 ssh-config 选项?

当 ssh 对他们来说太旧时,有条件地跳过 ssh-config 选项?

我如何使用SetEnv(以及不同系统上的相同配置),但在太旧而无法支持它~/.ssh/config时不抛出错误?ssh

我尝试添加一条语句以在太旧时Match exec排除该设置(OpenSSH < 7.8):ssh

Host server.example.com webhost
    User jacktose
    HostName server239.example.com
Match host "server.example.com webhost" exec "ssh -V 2>&1 | sed -nE '/^OpenSSH_(7\.(8|9|\d\d+)|(8|9|\d\d+\.))/!{q7}'"
    SetEnv LANG=C

但似乎该SetEnv行已被解析并抛出错误:

$ ssh -vvv anyhost
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
...
debug2: checking match for 'host "server.example.com webhost" exec "ssh -V 2>&1 | sed -nE '/^OpenSSH_(7\\.(8|9|\\d\\d+)|(8|9|\\d\\d+\\.))/!{q7}'"' host anyhost originally anyhost
debug3: /home/jacktose/.ssh/config line 37: not matched 'host "anyhost"' 
debug3: /home/jacktose/.ssh/config line 37: skipped exec "ssh -V 2>&1 | sed -nE '/^OpenSSH_(7\\.(8|9|\\d\\d+)|(8|9|\\d\\d+\\.))/!{q7}'"
debug2: match not found
/home/jacktose/.ssh/config: line 38: Bad configuration option: setenv
...
/home/jacktose/.ssh/config: terminating, 1 bad configuration options

相关内容