SSH + netcatを介したマルチホップrsyncが迅速に失敗する:接続が予期せず終了する

SSH + netcatを介したマルチホップrsyncが迅速に失敗する:接続が予期せず終了する

サーバーからクライアントにディレクトリを同期したいと思います。サーバーに直接接続することはできませんが、SSHゲートウェイを経由する必要があります。私の ".ssh/config"から:

Host gw
    User ab123456
    HostName gw.somewhere.ac.uk
    IdentityFile ~/.ssh/id_dsa.pub
    ServerAliveInterval 60

Host remote
    User me
    HostName remote.somewhere.ac.uk
    IdentityFile ~/.ssh/id_dsa.pub
    ProxyCommand nohup ssh gw netcat -w1 %h %p
    ServerAliveInterval 60

対話型セッションでは機能しsshますrsyncが失敗します。時にはすぐ​​に、時には数秒後、常にファイルをコピーする前に:

$ rsync -av remote:/path/to/somewhere/ somewhere/
nohup: redirecting stderr to stdout
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(226) [Receiver=3.1.0]

$ rsync -av remote:/path/to/somewhere/ somewhere/
nohup: redirecting stderr to stdout

            Access to this system is monitored etc. etc.

receiving incremental file list
Write failed: Broken pipe
rsync: connection unexpectedly closed (12288 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [receiver=3.1.0]
rsync: connection unexpectedly closed (16336 bytes received so far) [generator]
rsync error: unexplained error (code 255) at io.c(226) [generator=3.1.0]

netcat問題はデバイスのゲートウェイに関連しているようですgw。マルチホップ接続を使用する必要があるときにrsyncを正しく使用する方法は?

私は同僚が通常のSSHで動作するこの設定ファイルを提供したので、netcatを使用しています。

ケースとは異なる点を参考にしてくださいこの問題rsync -av、に置き換えたときも同じ問題が発生しました(そして正しく同期する機能がscp -pr本当に必要でした)。rsync

ベストアンサー1

交換して動作させることができます。

#ProxyCommand nohup ssh gw netcat -w1 %h %p

そして

ProxyCommand nohup ssh gw -W %h:%p

最新のOpenSSHで動作します。今すぐ停止しません。

おすすめ記事