linux 修改 rsyncd.conf 配置文件

[root@rsync-server-1 ~]# cat > /etc/rsyncd.conf << EOF

#Rsync server

#created by sunsky 00:17 2013-06-28

##rsyncd.conf start##

uid = root      # rsync 对后面模块中的 path 路径拥有什么权限

gid = root      # rsync 对后面模块中的 path 路径拥有什么权限

use chroot = no      # 安全操作

max connections = 2000      # 定义连接数 2000

timeout = 600      # 600 秒超时

pid file = /var/run/rsyncd.pid

lock file = /var/run/rsync.lock

log file = /var/log/rsyncd.log

ignore errors      # 忽略错误

read only = false    # false 才能上传文件,true 不能上传文件

list = false    # 文件列表

hosts allow = 172.16.100.0/24

hosts deny = *

auth users = rsync_backup    # 虚拟用户,同步时需要用这个用户

secrets file = /etc/rsync.password       # 密码文件

##################################### [web] # 模块名称

comment = redhat.sx site files by sunsky 00:17 2013-06-28    # 注释

path = /data/web/redhat.sx                 # 模块的路径

[data]

comment = redhat.sx site sit data files by sunsky 00:17 2013-06-28 path = /data/web_data/redhat.sx

##################################### EOF 特别提示:此处,使用一个多目录同步的案例。大家可以看需求,如果需求只有一个,那仅仅

做一个目录即可。

上面的 rsync 服务的配置文件,表明允许 172.16.100.0 网段的主机访问,rsync 同步模块名为

[web]和[data],将同步过来的文件分别放入对应 path 指定的目录/data/web/redhat.sx,

/data/web_data/redhat.sx 下。

如果有多台目标服务器,则每一台都需要进行类似的 rsync 服务端配置,上面的 uid 和

gid 需要换成你服务器的相应的同步用户。注意,rsync 服务账户(本文用 root)要有对被同

步目录(/data/web/redhat.sx 和/data/web_data/redhat.sx)的写入和更新权限。

猜你喜欢

转载自www.cnblogs.com/fanweisheng/p/11326814.html
今日推荐