Networking

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • hbb"-signs in rsync as well as in embedded ssh command

    7 answers - 2825 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    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
  • No.1 | | 267 bytes | |

    Fri 21 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
  • No.2 | | 1260 bytes | |

    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.
  • No.3 | | 727 bytes | |

    Quoting Paul Slootman <paul (AT) debian (DOT) org>:
    Fri 21 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

    This also results in the following errormessage on my system:
    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)

    So I'm affraid it suffers from the same problem as when using \" for the options
    for ssh.

    Regards,
    Peter
  • No.4 | | 816 bytes | |

    Quoting Matt McCutchen <hashproduct (AT) verizon (DOT) net>:
    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.

    Thanks Matt, the shell script indeed solves the problem.

    Peter
  • No.5 | | 385 bytes | |

    Fri 21 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
  • No.6 | | 1168 bytes | |

    Fri, 2005-10-21 at 16:44 +0200, Paul Slootman wrote:
    Fri 21 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)?

    No; rsync splits the command at space characters without observing any
    of the more sophisticated conventions, such as quoting or escaping, that
    shells do. Here's the relevant excerpt from rsync/main.c :

    static pid_t do_cmd(char *cmd, char *machine, char *user, char *path,
    int *f_in, int *f_out)
    {
    []
    for (tok = strtok(cmd, " "); tok; tok = strtok(NULL, " ")) {
    /* Comparison leaves rooms for server_options(). */
    if (argc >= MAX_ARGS - MAX_SERVER_ARGS) {
    rprintf(FERRR, "internal: args[] overflowed in do_cmd()\n");
    exit_cleanup(RERR_SYNTAX);
    }
    args[argc++] = tok;
    }
    []
    }

    And strtok just looks for occurrences of the indicated character(s) --
    here spaces.
  • No.7 | | 633 bytes | |

    Fri 21 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)?

    No; rsync splits the command at space characters without observing any
    of the more sophisticated conventions, such as quoting or escaping, that
    shells do. Here's the relevant excerpt from rsync/main.c :

    How about tabs? :-)

    Paul Slootman

Re: hbb"-signs in rsync as well as in embedded ssh command


max 4000 letters.
Your nickname that display:
In order to stop the spam: 6 + 5 =
QUESTION ON "Networking"

EMSDN.COM