rsync 服务与配置文档
1 某项目rsync配置文档(关键字已处理)
$ cat /etc/rsyncd.conf
- #全局配置
- log file = /var/log/rsyncd.log #日志文件
- pid file = /var/run/rsyncd.pid #pid文件
- lock file = /var/run/rsync.lock #支持max connections参数的锁文件
- max connections = 100 #客户端最大连接数为100
- use chroot = no #不使用chroot !!
- uid = dongnan #服务器端传输文件时,要发哪个用户和用户组来执行;
- gid = dongnan ###默认是nobody 用户和用户组
- ignore errors #忽略一些无关的IO错误
- list = no #不允许列文件
- #address = 10.0.100.71 #监听的ip地址与端口号
- #port = 873
- motd file = /etc/rsyncd/rsyncd.motd #定义服务器信息,用户登录时会看到这个信息
- #模块配置
- [htdocs] #模块名称
- path = /data/htdocs/ #指定目录
- comment = htdocs #注释
- read only = yes #只读
- auth users = dongnan #基于用户认证,如果没有这行则是匿名,多个用户用","分隔
- secrets file = /etc/rsyncd.secrets #保存用户密码,格式如下 cat /etc/rsyncd.secrets
- ### dongnan:654321
- [iso]
- path = /data/iso/
- comment = iso
- read only = no #可写
- hosts allow = 10.0.100.0/24 #基于IP地址认证,多个IP地址用空格" "分隔
2 启动 rsync 服务
- rsync --daemon
3 rsync 协议与端口
- $ grep -iE '^rsync' /etc/services
- rsync 873/tcp # rsync
- rsync 873/udp # rsync
4 验证 rsync 服务
- $ lsof -i :873
- COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
- rsync 24683 root 3u IPv6 1568026 TCP *:rsync (LISTEN)
- rsync 24683 root 5u IPv4 1568027 TCP *:rsync (LISTEN)
- rsync 27218 dongnan 4u IPv4 1584387 TCP 192.168.57.71:rsync->192.168.6.150:35444 (ESTABLISHED)
- $ rsync -avzP perl 192.168.57.71::data/
- rsync server for 10.0.100.0/24 or 192.168.57.0/24
- building file list ...
- 2 files to consider
- sent 82 bytes received 16 bytes 196.00 bytes/sec
- total size is 368 speedup is 3.76
参考
http://os.51cto.com/art/201006/203217.htm
http://www.centos.bz/2011/06/rsync-server-setup/
http://www.ibm.com/developerworks/cn/linux/l-cn-chroot/
结束
rsync 模块配置灵活,基于IP地址认证或者基于用户认证,可以根据实际需求配置。
更多欢迎到此讨论:
71921660 37275208 (已满)
本文转自 dongnan 51CTO博客,原文链接:http://blog.51cto.com/dngood/826632