免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1783 | 回复: 2
打印 上一主题 下一主题

你会使用rsync吗? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-05-17 17:03 |只看该作者 |倒序浏览
相信来看本贴都是高手,最近在使用rsync作同步时却遇到了一个不小的麻烦.内网从外网的服务器上同步数据回来做备份,应该说使用rsync是很方便的,由于考虑文件的安全性肯定要采用ssh方式了,问题就出在这里,因为同样出于安全ssh端口更改为不是22的非常用端口,rsync的使用参数中找不到如何来指定ssh的端口.在rsync的官方网站:rsync.samba.org的如何绕过防火墙的回答中好像找到了方法:
   
The first thing we need is an ssh configuration that will allow us toconnect to the forwarded port as if we were connecting to the targetsystem, and we need ssh to know what we're doing so that it doesn'tcomplain about the host keys being wrong.  We can do this by adding thissection to your ~/.ssh/config file (substitute "target" and "target_user"as appropriate, but leave "localhost" unchanged):
Host target
  HostName localhost
  Port 2222
  HostKeyAlias target
  User target_user
Next, we need to enable the port forwarding:
ssh -fN -l middle_user -L 2222:target:22 middle
What this does is cause a connection to port 2222 on the local system toget tunneled to the middle system and then turn into a connection to thetarget system's port 22.  The -N option tells ssh not to start a shell onthe remote system, which works with modern ssh versions (you can run asleep command if -N doesn't work).  The -f option tells ssh to put thecommand in the background after any password/passphrase prompts.
With this done, you could run a normal-looking rsync command to "target"that would use a connection to port 2222 on localhost automatically:
rsync -av target:/src/ /dest/

但百试不灵,不知各位大侠还有什么其他高招?

论坛徽章:
0
2 [报告]
发表于 2007-05-17 17:33 |只看该作者
现在去米鼠网注册会员

就能回答趣味题目赢的米鼠积分

1积分=1RBM  可以直接网上购物

网址:www.mylinux.com.cn

论坛徽章:
0
3 [报告]
发表于 2007-05-18 02:25 |只看该作者
rsync -av[z] --rsh=ssh [--progress] [sourceIP:]/path[/filename] [targetIP:]/path/[filename]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP