Commit 8b85b37
committed
Execute ProxyCommand in a shell
The ProxyCommand in my ssh config looks something like
ProxyCommand foo --bar\=baz
The backslash ahead of = is definitely weird, but the ssh config gets
generated by a Ruby script, and that's how Ruby's Shellwords.escape
escapes tokens. This config works with ssh, but not open-remote-ssh
because the backslash ends up in the argument passed to foo.
According to man ssh_config, "[ProxyCommand] is executed using the
user's shell 'exec' directive to avoid a lingering shell process," so I
guess ssh just substitutes the tokens in the string and executes the
command in a shell, and the shell processes the backslash.
We can see that ssh doesn't try escaping tokens by running
$ ssh -o ProxyCommand='printf "%%q\n" %h 1>&2' "foo bar"
foo
bar
Despite "foo bar" being one token, it gets passsed to printf as two
arguments, so I guess if we want to match ssh's behaviour we should do
the same? I'm not sure what's up with Windows, so I left it alone for
now.1 parent 8191939 commit 8b85b37
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
164 | 168 | | |
165 | 169 | | |
166 | 170 | | |
| |||
0 commit comments