服务器间拷贝文件 大家有什么好用的工具推荐吗

2018-10-13 10:19:58 +08:00
 fangyh09

环境: 我本地 macOS 系统 local, 远程服务器 s1, s2, s3

需求: s1 s2 s3 之间文件互相拷贝

之前我用的是 scp, 但是每天都需要敲蛮长的命令

有什么 gui 工具可以直接把 s1 的文件拖到 s2 上吗,现在找到的工具是 local 可以和 s1 文件互拖

8553 次点击
所在节点    Linux
65 条回复
l4ever
2018-10-15 08:12:41 +08:00
rsync
zhouzm
2018-10-15 13:37:37 +08:00
$> man scp
-3 Copies between two remote hosts are transferred through the local host. Without this option the data is copied directly between the two remote
hosts. Note that this option disables the progress meter.

$> man rsync
Rsync copies files either to or from a remote host, or locally on the current host (it does not support copying files between two remote hosts).

也就是说 scp 可以直接在两台远程主机间传输而 rsync 不能。
建议楼主可以在 mac 上写个脚本快速生成待传输文件列表,再怎么变化总会有一定规律的吧?然后再用 scp 写个传输脚本就可以了。
当然了,在此之前做好 ssh key 密钥配置免密码登录是必要的。

另外:
如果楼主迷恋于 gui 工具的可视直观性。可以试一下 Double Commander (Free) 或者 Commander One (Freemium),使用 sftp 连接服务器,两个面板拖拽一下也挺方便的。
4ever911
2018-10-17 00:01:56 +08:00
scp alias
panzhc
2018-10-20 11:29:48 +08:00
编辑 $HOME/.ssh/config
Host s1
HostName 1.1.1.1
User root
Port 22
Host s2
HostName 1.1.1.2
User root
Port 22
Host s3
HostName 1.1.1.3
User root
Port 22

Mac 上执行
scp -3r s1:/path s2:/path
scp -3r s1:/path s3:/path
panzhc
2018-10-20 11:31:47 +08:00
@panzhc 补充一下,
scp -3 直接支持两台服务器之间拷贝
配置了 config 以后,登录服务器也很方便,直接 ssh s1

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/497262

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX