博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Rsync完全配置
阅读量:7049 次
发布时间:2019-06-28

本文共 2693 字,大约阅读时间需要 8 分钟。

系统环境---Rsync完全配置
rsync version 2.6.3 protocol version 28
Slackware 9.2
配置/etc/rsyncd.conf
如果没有创建rsyncd.conf文档,自己需要创建rsyncd.conf文档(下面其实配置相同)
[root@linuxas3 root]# vi /etc/rsyncd.conf
uid=nobody
gid=nobody
max connections=4
use chroot=no
log file=/var/log/rsyncd.log
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock
#auth users=root
secrets file=/etc/rsyncd.secrets
[postfix]
path=/var/mail
comment = backup mail
ignore errors
read only = yes
list = no
auth users = postfix
[netkiller]
path=/home/netkiller/web
comment = backup 9812.net
ignore errors
read only = yes
list = no
auth users = netkiller
[pgsqldb]
path=/var/lib/pgsql
comment = backup postgresql database
ignore errors
read only = yes
list = no
选择说明
uid = nobody
gid = nobody
use chroot = no # 不使用chroot
max connections = 4 # 最大连接数为4
pid file = /var/run/rsyncd.pid #进程ID文件
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log # 日志记录文件
secrets file = /etc/rsyncd.pwd # 认证文件名,主要保存用户密码,权限建议设为600,所有者root
[module] # 这里是认证的模块名,在client端需要指定
path = /var/mail # 需要做镜像的目录
comment = backup xxxx # 注释
ignore errors # 可以忽略一些无关的IO错误
read only = yes # 只读
list = no # 不允许列文件
auth users = postfix # 认证的用户名,如果没有这行,则表明是匿名
[other]
path = /path/to...
comment = xxxxx
密码文件A,(被认证的用户,就是本地与要其它地同上时,需要的认证用户)
在server端生成一个密码文件/etc/rsyncd.pwd
[root@linuxas3 root]# echo postfix:xxx >>/etc/rsync_passwd
[root@linuxas3 root]# chmod 600 /etc/rsync_passwd
密码文件B,(为远程用户的认证:就是其它需要与本地同步时,远程PC在执行同步时所需要的帐号)
在server端生成一个密码文件/etc/rsyncd.secrets 
[root@linuxas3 root]# echo postfix:xxx >>/etc/rsyncd.secrets
[root@linuxas3 root]# chmod 600 /etc/rsyncd.secrets
启动rsync daemon
[root@linuxas3 root]# rsync --daemon
测试
[root@linux docbook]# rsync rsync://www.9812.net/netkiller
[root@linux tmp]# rsync rsync://netkiller@
Password:
[chen@linux temp]$ rsync -vzrtopg --progress --delete postfix@
 /tmp
Password:
rsync rsync://认证用户@主机/模块
rsync -vzrtopg --progress --delete 认证用户@主机::模块 /mirror目录
添加到启动文件
echo "rsync --daemon" >> /etc/rc.d/rc.local
完成!
rsync的参数不是很多,比较常用的:
-z 压缩
-r 递归,就是文件夹下所有东西
-l 链接当链接
-t 同步文件时间
-o -g 同步文件owner group
郁闷的问题:
2.4.29 Slackware linux
我用编的脚本运行一些同步时,系统有提示:password file must not be other-accessible,
-rw-r--r--   1 root   root   11 Oct 17 09:45 /etc/rsync_passwd
-rw-r--r--   1 root   root   1097 Feb 7 09:33 /etc/rsyncd.conf
-rw-r--r--   1 root   root   12 Feb 3 2004 /etc/rsyncd.secrets
我把这些文件都改为如下600,则OK,,
-rw-----   1 root   root   11 Oct 17 09:45 /etc/rsync_passwd
-rw-----   1 root   root   1097 Feb 7 09:33 /etc/rsyncd.conf
-rw-----   1 root   root   12 Feb 3 2004 /etc/rsyncd.secrets
但是在2.4.20 Slackware linux,这些文件属性就是(644) -rw-r--r-- ,可能是版的原因
笔记吧学习网(BIJIBA.com),版权所有!如需转载,务请保留此行文字,谢谢!!
    本文转自eyjian 51CTO博客,原文链接:http://blog.51cto.com/mooon/908930,如需转载请自行联系原作者
你可能感兴趣的文章
使用 Consul 作为 Python 微服务的配置中心
查看>>
简单工厂模式
查看>>
Flutter混合工程开发探究
查看>>
引 jar包时出现 managed怎么处理
查看>>
JavaScript单元测试框架
查看>>
三周学会小程序第三讲:服务端搭建和部署
查看>>
IE浏览器低版本判断及升级提示
查看>>
乳腺增生的早期症状?乳腺增生做什么检查最好
查看>>
iOS 多线程-NSThread
查看>>
区块链100讲:关于DApp的问与答
查看>>
【缺缺缺人】杭州阿里飞猪招前端端端
查看>>
手柄按键显示器
查看>>
我的个人博客搭建日志 Flask篇之官方教程
查看>>
如何实现选项卡切换
查看>>
七牛云招聘~高级全栈开发工程师
查看>>
Android源码解析之一 异步消息机制
查看>>
Promise 源码解析
查看>>
自用ES6笔记
查看>>
java B2B2C springmvc mybatis仿淘宝电子商城系统-Hystrix服务容错
查看>>
android学习笔记2 单位
查看>>