Peter van der Meer
2005-Oct-21 12:56 UTC
"-signs in rsync as well as in embedded ssh command
Hello, Today I succesfully transfered some testfile on my local computer with the following command: rsync -e "ssh" testfile.txt localhost:receive I can also succesfully connect with SSH to a remote server through an http proxy with the following command: ssh -o "ProxyCommand corkscrew myhttpProxy 8080 targetcomputer.domain 22" targetcomputer.domain But I'm so far unable to combine them, mostly because the "-signs in the SSH command seem to conflict with the "-signs in the rsync command. I've tried the following combinations with the following results: command: rsync -e "ssh -o \"ProxyCommand corkscrew myhttpProxy 8080 targetcomputer.domain 22\"" testfile.txt targetcomputer.domain:receive results in: command-line: line 0: Bad configuration option: "ProxyCommand rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(420) command: rsync -e "ssh -o \\"ProxyCommand corkscrew myhttpProxy 8080 targetcomputer.domain 22\\"" testfile.txt targetcomputer.domain:receive results in: command-line: line 0: Bad configuration option: \\ProxyCommand rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(420) command: rsync -e "ssh -o \\\"ProxyCommand corkscrew myhttpProxy 8080 targetcomputer.domain 22\\\"" testfile.txt targetcomputer.domain:receive results in: command-line: line 0: Bad configuration option: \\"ProxyCommand rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(420) command: rsync -e "ssh -o ProxyCommand corkscrew myhttpProxy 8080 targetcomputer.domain 22" testfile.txt targetcomputer.domain:receive results in: command-line line 0: Missing argument. rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(420) command: rsync -e "ssh -o ProxyCommand\ corkscrew\ myhttpProxy\ 8080\ targetcomputer.domain\ 22" testfile.txt targetcomputer.domain:receive results in: command-line: line 0: Bad configuration option: ProxyCommand\\ rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(420) I've read the firewalls section in the manual and the thread from yesterday about multiple SSH-hops, but unfortunately none of the sollutions there need any "-signs in the ssh command. Does anybody here has another suggestion? Regards, Peter van der Meer
On Fri 21 Oct 2005, Peter van der Meer wrote:> Does anybody here has another suggestion?Yes: rsync -e "ssh -o 'ProxyCommand corkscrew myhttpProxy 8080 targetcomputer.domain 22'" testfile.txt targetcomputer.domain:receive Paul Slootman
On Fri, 2005-10-21 at 14:56 +0200, Peter van der Meer wrote:> Today I succesfully transfered some testfile on my local computer with the > following command: > rsync -e "ssh" testfile.txt localhost:receive > > I can also succesfully connect with SSH to a remote server through an http proxy > with the following command: > ssh -o "ProxyCommand corkscrew myhttpProxy 8080 targetcomputer.domain 22" > targetcomputer.domain > > But I'm so far unable to combine them, mostly because the "-signs in the SSH > command seem to conflict with the "-signs in the rsync command.The trouble is that rsync parses the "-e" command into arguments, and it just splits at every whitespace character without regard for the inner quotes. Maybe rsync should really be calling on a shell to parse the command. I can think of two ways to work around this: (1) Put the ProxyCommand option in your ~/.ssh/config so that SSH will use it automatically whenever you connect to targetcomputer.domain . (2) If you don't want that, write a shell script like this: #!/bin/bash ssh -o "ProxyCommand corkscrew myhttpProxy 8080 targetcomputer.domain 22" "$@" and supply the name of this shell script as the "-e" command. -- Matt McCutchen, ``hashproduct'' hashproduct@verizon.net -- http://mysite.verizon.net/hashproduct/
On Fri 21 Oct 2005, Matt McCutchen wrote:> > The trouble is that rsync parses the "-e" command into arguments, and it > just splits at every whitespace character without regard for the inner > quotes. Maybe rsync should really be calling on a shell to parse the > command.Would escaping the spaces perhaps also work (in addition to the wrapper script)? Paul Slootman
Manuel López-Ibáñez
2005-Oct-22 00:08 UTC
"-signs in rsync as well as in embedded ssh command
> The trouble is that rsync parses the "-e" command into arguments, and it > just splits at every whitespace character without regard for the inner > quotes. Maybe rsync should really be calling on a shell to parse the > command.Really? Does this mean that any option passed to ssh is interpreted by rsync? For example, rsync -e "ssh -p port -i mykey " myfile target:/remote/path/ Are -p and -i interpreted by ssh or by rsync? Actually, I did the experiment and the -p command is taken by ssh and not by rsync, so I understood you wrongly: what you said is that command inside ssh cannot use shell metacharacters (", *, ?, etc). However, ... tachan! Is it very complicated to use several -o before each option? If you try: rsync -e "ssh -o Port=22 -o ClearAllForwardings=yes -o ConnectTimeout=5 target" myfile :/remote/path/ It works perfectly!! However, is there any possible scenario where the argument of -e should be interpreted by a shell? Anyway, does the shell would understand the nested quotes at all? If not, then even if the -e argument is interpreted by a shell, it won't make any difference in this case, will it? Perhaps, this might be considered to be added to rsync in the future. Perhaps not! Cheers, Manuel. (yes, you are so cool people, that I joined the list for fun! XDD) ______________________________________________ Renovamos el Correo Yahoo! Nuevos servicios, m?s seguridad http://correo.yahoo.es