Use rsync with nc as transport layer

1

1

By default, rsync uses ssh as a transport layer. Unfortunately with fast local network, ssh is very slow. Is it possible use rsync with netcat / nc ?

I have make some experiments, but it does not work for me. I want eliminate ssh, because it is bottelneck.

Of course, I want use it with Linux.

Znik

Posted 2018-06-11T08:25:33.167

Reputation: 259

Answers

1

Here is an example using the debian/ubuntu version of nc (using named pipe as described in nc(1) because nc doesn’t have -e or -c)

On the server side:

rm -f /tmp/rsyncpipe && mkfifo /tmp/rsyncpipe && cat /tmp/rsyncpipe | (read cmd && eval "$cmd") | nc -l 1243 >/tmp/rsyncpipe

On the client side:

rsync --progress --rsh='bash -c "(echo ""$@""; cat) | nc $0 1243"' <file> 10.142.0.119:<file>

Unfortunately, due to the fifo, rsync stays open even after the transfer is complete, so you have to Ctrl+C on both sides when it looks like it’s done (when --progress reports to-check=0/n).

yonran

Posted 2018-06-11T08:25:33.167

Reputation: 482

0

I think that will not work, because rsync need access to the destination filesystem. But, what about using an alternate shell using --rsh operator or using rsync in daemon mode?

Winnie Tigger

Posted 2018-06-11T08:25:33.167

Reputation: 144