chr*_*ris 11 ssh rsync file-transfer scp ssh-tunnel
我有一台机器在几跳之外,我需要设置端口转发才能传输文件。
编辑:需要明确的是,需要多跳才能访问远程机器。在我的机器上,我设置了一个 VPN,我可以在其中访问 10.255.xx - 这是我可以通过 VPN 连接的唯一机器。一旦登录到 .xx,我就可以连接到其他机器 - .yy 就是其中之一。
从我的机器:
ssh -L 4567:localhost:4567 me@10.255.x.x
Run Code Online (Sandbox Code Playgroud)
然后从那台机器:
ssh -L 4567:localhost:22 me@10.255.y.y
Run Code Online (Sandbox Code Playgroud)
那我可以
scp -P 4567 me@localhost:/path/to/large/file.gz .
Run Code Online (Sandbox Code Playgroud)
我让这个运行过夜,才发现转移在某个时候死了。
我已经看到一些建议使用 rsync over ssh 来恢复传输,但我不清楚如何设置。这可能吗?
Den*_*nis 10
对于某些版本的 scp(源计算机上的版本似乎是关键),只需重新执行 scp 命令就足以恢复传输。不过要小心!如果您的版本不支持部分传输,部分文件将被简单地覆盖。
如果 scp 不支持,以下 rsync 开关对于恢复损坏的传输非常方便:
--append append data onto shorter files
--append-verify like --append, but with old data in file checksum
-e, --rsh=COMMAND specify the remote shell to use
--progress show progress during transfer
Run Code Online (Sandbox Code Playgroud)
命令
rsync --append-verify --progress --rsh="ssh -p 4567" me@localhost:/path/to/large/file.gz .
Run Code Online (Sandbox Code Playgroud)
应该有想要的效果。请注意,-p
ssh的开关必须是小写的。
小智 5
使用 sftp 代替 scp
在你的情况下:
sftp -a -P 4567 me@localhost:/path/to/large/file.gz .
Run Code Online (Sandbox Code Playgroud)
从 sftp 手册页:
-a Attempt to continue interrupted downloads rather than overwriting existing partial or complete copies of files. If the remote file contents differ from the partial local copy then the resultant file is likely to be corrupt.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
21731 次 |
最近记录: |