Sample Header Ad - 728x90

Conditionally skip ssh-config options when ssh is too old for them?

2 votes
0 answers
350 views
How can I use SetEnv in ~/.ssh/config (and the same config on various systems), but not throw an error when ssh is too old to support it? I've tried adding a Match exec statement to exclude that setting when ssh is too old (OpenSSH &1 | sed -nE '/^OpenSSH_(7\.(8|9|\d\d+)|(8|9|\d\d+\.))/!{q7}'" SetEnv LANG=C
But it seems like the SetEnv line is parsed and throws an error anyway:
$ 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 ```
Asked by Jacktose (533 rep)
Jun 23, 2023, 09:06 PM