Rsync相当于scp

编程入门 行业动态 更新时间:2024-10-27 18:27:21
Rsync相当于scp -3(Rsync equivalent to scp -3) 网络A的远程服务器A上的大文件 大文件需要转到网络B的远程服务器B(仅可通过VPN访问) 我可以使用rsa密钥(为方便起见,在ssh配置文件中配置)和我机器上的VPN客户端连接到两台机器。 如果没有冗长的官僚程序,我无法更改任何远程计算机上使用的密钥。

这让我相信我最好的行动方案是使用我的机器作为这两台机器之间的ssh桥的中介。

我最初的解决方案是使用脚本系列的scp -3r命令将目录从A:A移动到B:B。 但是,即使使用arcfour并具有稳定的网络连接,此过程也非常缓慢且易碎。

Rsync能够使用--partial--append-verify在停止时恢复进程,这样我就可以安全地在我的机器上执行此任务,并让它在需要时自动重启几天。

我的问题是:什么是rsync相当于scp -3 ? 我尝试的解决方案将通过运行进行调整

*rsync *???* user@A:path/to/big/files otheruser@B:path/to/desired/location -F /path/to/specific/.ssh/config

或者,根据我的约束,你能否建议一种方法来完成这种转移?

最后的方法是通过sshfs安装这些系统,并尝试制定一组更合适的命令(更慢,更慢)

谢谢大家

Big Files on remote server A, of network A Big Files need to go to remote server B, of network B (accessible by VPN only) I can connect to both machines using rsa keys (configured in ssh config file for convenience) and a VPN client from my machine. I cannot change the keys used on either remote machine without a lengthy bureaucratic process for each.

This leads me to believe that my best course of action is to use my machine as the intermediary in an ssh bridge between these two machines.

My initial solution was to use a scripted series of scp -3r commands to move directories from A:A to B:B. However, even when using arcfour and with a stable network connection, this process is very slow and fragile.

Rsync has the capability to use --partial and --append-verify to resume processes when they are stopped, such that I can safely background this task on my machine and let it run for a few days with automatic restart when needed.

My question is: What is the rsync equivalent to scp -3? My attempted solution would be adapted by running

*rsync *???* user@A:path/to/big/files otheruser@B:path/to/desired/location -F /path/to/specific/.ssh/config

Alternatively, can you please suggest a method to accomplish this transfer given my constraints?

The method of last resort will be to mount these systems via sshfs and attempt to formulate a more amenable set of commands (much, much slower)

Thanks all

最满意答案

您可以使用ssh来设置隧道,以便rsync做正确的事情。

在您的本地机器上:

ssh -M -R 9999:serverB:22 serverA rsync -a --rsh "ssh -p 9999" /path/to/big/files/ localhost:/path/to/desired/location/

其中“9999”是您喜欢的任何端口号,只要它在两个地方匹配,“22”是serverB上的SSH端口号(通常为22)。

-R选项执行反向隧道,将通过本地计算机连接到serverA:9999任何程序路由到serverB:22 。 (实际上,除非您添加“绑定地址”,否则访问仅限于在serverA上运行的本地程序,连接到localhost:9999 ,因此它是安全的。)

--rsh "ssh -p 9999"选项告诉rsync使用带有非标准端口号(9999)的ssh。

-M选项可能不是必需的,但它可以解决SSH连接共享可能出现的问题。

You can use ssh to set up a tunnel so that rsync does the right thing.

On your local machine:

ssh -M -R 9999:serverB:22 serverA rsync -a --rsh "ssh -p 9999" /path/to/big/files/ localhost:/path/to/desired/location/

where "9999" is any port number you like, as long as it matches in both places, and "22" is the SSH port number on serverB (usually 22).

The -R option does a reverse tunnel that routes any program connecting to serverA:9999 via your local machine through to serverB:22. (Actually, unless you add a "bind address", access is limited to local programs running on serverA, connecting to localhost:9999, so it's secure.)

The --rsh "ssh -p 9999" option tells rsync to use ssh with a non-standard port number (9999).

The -M option is probably not necessary, but it side-steps possible trouble with SSH connection sharing.

更多推荐

本文发布于:2023-07-16 07:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1125543.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Rsync   scp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!