找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 4|回复: 0

Rsync服务端配置

[复制链接]

25

主题

27

回帖

218

积分

管理员

积分
218
发表于 1 小时前 | 显示全部楼层 |阅读模式
源码部署安装Rsync服务

wget http://rsync.samba.org/ftp/rsync/src/rsync-3.0.7.tar.gz

tar xzf rsync-3.0.7.tar.gz

cd rsync-3.0.7

./configure --prefix=/usr/local/rsync

make

make install

创建配置文件,配置内容为如下:

vi /etc/rsyncd.conf

#########

[global]

uid = nobody

gid = nobody

use chroot = no

max connections = 30

pid file = /var/run/rsyncd.pid

lock file = /var/run/rsyncd.lock

log file = /var/log/rsyncd.log

transfer logging = yes

log format = %t %a %m %f %b

syslog facility = local3

timeout = 300

[www]

read only = yes

path = /usr/local/webapps

comment = www

auth users =test

secrets file = /etc/rsync.pas

hosts allow = 192.168.0.11,192.168.0.12

[web]

read only = yes

path = /data/www/web

comment = web

auth users =test

secrets file = /etc/rsync.pas

hosts allow = 192.168.0.11,192.168.0.0/24

Rsync配置参数含义

[www] #要同步的模块名

path = /usr/local/webapps #要同步的目录

comment = www #注释,解释模块的用于做什么备份

read only = no # no客户端可上传文件,yes只读

write only = no # no客户端可下载文件,yes不能下载

list = yes #是否提供资源列表

auth users =test #登陆系统使用的用户名,没有默认为匿名。

hosts allow = 192.168.0.10,192.168.0.20 #本模块允许通过的IP地址

hosts deny = 192.168.0.4 #禁止主机IP

secrets file=/etc/rsync.pas #密码文件存放的位置

启动服务器端RSYNC服务,默认监听端口TCP 873。

/usr/local/rsync/bin/rsync --daemon

设置rsync服务器端同步密钥,文件内容username:userpasswd (表示用户名:密码)

vi /etc/rsync.pas

jfedu:jfedu999

保存完毕,chmod 600 /etc/rsync.pas设置权限为宿主用户读写。

设置客户端配置同步密钥,文件内容userpasswd (表示密码)

vi /etc/rsync.pas

jfedu999

客户端执行同步命令,从服务端同步数据至本地

rsync -aP --delete jfedu@192.168.0.100::www /usr/local/webapps --password-file=/etc/rsync.pas

rsync -aP --delete jfedu@192.168.0.100::web /data/www/web --password-file=/etc/rsync.pas

注*/usr/local/webapps为客户端的目录,@前jfedu是认证的用户名;IP后面www为rsync服务器端的模块名称。
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表