1

clusterssh (cssh) can pass options to ssh:

cssh -o "-o ConnectTimeout=1" myserver.mydomain.org

I am trying to pass ProxyCommand option to ssh, but it does not work. With plain ssh, I can use this:

ssh -o ProxyCommand='ssh [email protected] nc %h %p' behind-fw.mydomain.org

which will connect to server non-routable.mydomain.org via 1.2.3.4. But when I try to use this with cssh:

cssh -o "-o ProxyCommand='ssh [email protected] nc %h %p'" non-routable.mydomain.org

I get this error:

Cannot open pipe for reading when talking to non-routable.mydomain.org : Interrupted system call

How can I pass ProxyCommand to cssh ?

400 the Cat
  • 819
  • 4
  • 37
  • 85

1 Answers1

1

If you want to pass whitespace within an option you need to see how quotes and double-quotes are handled by the perl script cssh. A simple way to do this is with the built-in debug option. At level 2 it will show you the xterm command that it is running. It is quite complex and includes an inline perl script that is enclosed in single quotes. Inside the script it sets a variable to a string enclosed in double quotes. So when you give an option like -o "-o 'x y'" what is being executed is:

xterm ... -e perl -e ' ... my $command="ssh -o 'x y'"; ... '

This breaks the perl script into 2 words, so will not work.

If you use double quotes in -o "-o \"x y\"", you get

... my $command="ssh -o "x y"";

This breaks the perl assignment, with x y being outside the string.

Finally, use single quotes and escaped double quotes, -o '-o \"x y\"', and it should work:

... my $command="ssh -o \"x y\"";
meuh
  • 49,672
  • 2
  • 52
  • 114
  • did you mean `... my $command='ssh -o \"x y\"';` instead of `... my $command="ssh -o \"x y\"";` in your last line ? – 400 the Cat Apr 01 '20 at 05:50
  • No, remember that the `my $command` lines are generated by cssh and so always have the form `my $command="xxxx";` where xxxx is copied directly from what you put after `-o` in the command line. The single quotes in `-o 'xxxx'` will have been removed by the shell. – meuh Apr 01 '20 at 07:06