Felipe Alvarez
Felipe Alvarez

Reputation: 3908

Using my own remote shell for rsync rsh

I have a script which we use internally to keep track of client names, hostnames, and SSH port numbers. This lives in /etc/clients.ssh

my script called "connect" (symlink "c") takes one argument $1 which is the client name. Then it opens a SSH session to the client, on that hostname, using that port number.. "C" can also take "-l username" for remote username.

I'd like to use this with rsync. The --rsh=COMMAND seems like the ticket, however I get

$ rsync -vvvvn -e 'c -l manager' abc:/tmp/
cmd=c -l manager machine=abc user=<NULL> path=/tmp/
cmd[0]=c cmd[1]=-l cmd[2]=manager cmd[3]=abc cmd[4]=rsync cmd[5]=--server cmd[6]=--sender cmd[7]=-vvvvnde.sf cmd[8]=. cmd[9]=/tmp/
opening connection using: c -l manager abc rsync --server --sender -vvvvnde.sf . /tmp/
note: iconv_open("UTF-8", "UTF-8") succeeded.
(Client) Protocol versions: remote=1886221359, negotiated=30
protocol version mismatch -- is your shell clean?
(see the rsync man page for an explanation)
[Receiver] _exit_cleanup(code=2, file=compat.c, line=174): entered
rsync error: protocol incompatibility (code 2) at compat.c(174) [Receiver=3.0.9]
[Receiver] _exit_cleanup(code=2, file=compat.c, line=174): about to call exit(2)

Upvotes: 0

Views: 1448

Answers (2)

Felipe Alvarez
Felipe Alvarez

Reputation: 3908

I've scraped this idea and just gone with stock ssh client from openssh.

Upvotes: 0

Benjamin Thiel
Benjamin Thiel

Reputation: 1135

From what I understand, you could replace your clients.ssh by creating an entry in .ssh/config for each client. For example, an entry called "foobar":

Host foobar
    HostName example.com #or IP address
    Port 980
    User test
    CheckHostIP no

Would enable you to simply ssh foobar into the host, as well as use rsync -SomeParameters foobar:/path/to/copy /path/to/local/storage to copy the desired files.

Upvotes: 2

Related Questions