admin 发表于 2026-10-9 09:33:07

源码部署安装Rsync服务<br><br>wgethttp://rsync.samba.org/ftp/rsync/src/rsync-3.0.7.tar.gz<br><br>tarxzfrsync-3.0.7.tar.gz<br><br>cd rsync-3.0.7<br><br>./configure --prefix=/usr/local/rsync<br><br>make<br><br>make install<br><br>创建配置文件,配置内容为如下:<br><br>vi /etc/rsyncd.conf<br><br>#########<br><br><br><br>uid = nobody<br><br>gid = nobody<br><br>use chroot = no<br><br>max connections = 30<br><br>pid file = /var/run/rsyncd.pid<br><br>lock file = /var/run/rsyncd.lock<br><br>log file = /var/log/rsyncd.log<br><br>transfer logging = yes<br><br>log format = %t %a %m %f %b<br><br>syslog facility = local3<br><br>timeout = 300<br><br><br><br>read only = yes<br><br>path = /usr/local/webapps<br><br>comment = www<br><br>auth users =test<br><br>secrets file = /etc/rsync.pas<br><br>hosts allow = 192.168.0.11,192.168.0.12<br><br><br><br>read only = yes<br><br>path = /data/www/web<br><br>comment = web<br><br>auth users =test<br><br>secrets file = /etc/rsync.pas<br><br>hosts allow = 192.168.0.11,192.168.0.0/24<br><br>Rsync配置参数含义<br><br>   #要同步的模块名<br><br>path = /usr/local/webapps#要同步的目录<br><br>comment = www    #注释,解释模块的用于做什么备份<br><br>read only = no   # no客户端可上传文件,yes只读<br><br>write only = no# no客户端可下载文件,yes不能下载<br><br>list = yes      #是否提供资源列表<br><br>auth users =test#登陆系统使用的用户名,没有默认为匿名。<br><br>hosts allow = 192.168.0.10,192.168.0.20#本模块允许通过的IP地址<br><br>hosts deny = 192.168.0.4   #禁止主机IP<br><br>secrets file=/etc/rsync.pas#密码文件存放的位置<br><br>启动服务器端RSYNC服务,默认监听端口TCP 873。<br><br>/usr/local/rsync/bin/rsync--daemon<br><br>设置rsync服务器端同步密钥,文件内容username:userpasswd (表示用户名:密码)<br><br>vi/etc/rsync.pas<br><br>jfedu:jfedu999<br><br>保存完毕,chmod 600 /etc/rsync.pas设置权限为宿主用户读写。<br><br>设置客户端配置同步密钥,文件内容userpasswd (表示密码)<br><br>vi/etc/rsync.pas<br><br>jfedu999<br><br>客户端执行同步命令,从服务端同步数据至本地<br><br>rsync -aP --delete jfedu@192.168.0.100::www /usr/local/webapps    --password-file=/etc/rsync.pas<br><br>rsync -aP --delete jfedu@192.168.0.100::web/data/www/web   --password-file=/etc/rsync.pas<br><br>注*/usr/local/webapps为客户端的目录,@前jfedu是认证的用户名;IP后面www为rsync服务器端的模块名称。
页: [1]
查看完整版本: Rsync服务端配置