默认值 空
strict modes
指定是否监测口令文件的权限。若为 true 则口令文件只能被 rsync 服务器运行身份的用户访问,其他任何用户不可以访问该文件。
默认值 true
> - rsync 认证口令文件的权限一定是 600,否则客户端将不能连接服务器。
rsync 认证口令文件中每一行指定一个 用户名:口令 对,格式为:username:passwd
一般来说口令最好不要超过8个字符。若您只配置匿名访问的 rsync 服务器,则无需设置上述参数。
配置文件实例
# GLOBAL OPTIONS uid = root gid = root use chroot = no read only = yes #limit access to private LANs hosts allow=172.16.0.0/255.255.0.0 192.168.1.0/255.255.255.0 10.0.1.0/255.255.255.0 hosts deny=* max connections = 5 pid file = /var/run/rsyncd.pid secrets file = /etc/rsyncd/rsyncd.secrets #lock file = /var/run/rsync.lock #motd file = /etc/rsyncd/rsyncd.motd #This will give you a separate log file #log file = /var/log/rsync.log #This will log every file transferred - up to 85,000+ per user, per sync transfer logging = yes log format = %t %a %m %f %b syslog facility = local3 timeout = 300 # MODULE OPTIONS [davidhome] path = /home/david/ list=yes ignore errors auth users = david comment = David home exclude = important/ [chinatmp] path = /tmp/china/ list=no ignore errors auth users = china comment = tmp_china
密码文件
david:asdf #格式 用户名:口令 china:jk #该用户不要求是系统用户
查看rsync服务是否启动
netstat -an | grep 873
rsync 客户端
# 安装客户端 yum -y install rsync # 同步命令 # -a 参数,相当于-rlptgoD # -r 是递归 -l 是链接文件,意思是拷贝链接文件;-p 表示保持文件原有权限 # -t 保持文件原有时间;-g 保持文#件原有用户组;-o 保持文件原有属主;-D 相当于块设备文件 # -z 传输时压缩; # -P 传输进度; # -v 传输时的进度等信息,和-P有点关系,自己试试。可以看文档; # 同步 rsync -avzP david@172.16.1.135::davidhome /tmp/david/ # 客户端数据和服务器端数据保持一致 rsync -avzP --delete david@172.16.1.135::davidhome /tmp/david/ # 指定传输时候的密码文件,密码文件权限 600 rsync -avzP --delete --password-file=/tmp/rsync.password david@172.16.1.135::davidhome /tmp/david/
希望本文所述对大家CentOS服务器配置有所帮助。








