测试环境:CentOS-2.6.32.x86_64
10.0.3.161:主服务器
10.0.3.160:客户端服务器
安装软件:yum install rsync xinetd
修改配置文件:
vi /etc/xinetd.d/rsync
disable = no 改成: yes
默认端口是:873
主服务器配置:
在/etc/下创建三个文件
配置文件:rsyncd.conf 欢迎语:rsyncd.motd 密码文件:rsyncd.secrets
1.vi rsyncd.conf
read only = no
list = yes
uid = root
gid = root
Use chroot =no
hosts allow = 10.0.3.0/16 #允许连接IP段
max connections = 10 #连接数限制
log file = /var/log/rsyncd.log #日志存储路径
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
motd file = /etc/rsyncd.motd #欢迎语
#define dirctory for rsync
[jackey]
path =/opt/pub #文件目录
secrets file =/etc/rsyncd.secrets #密码文件
auth users = jackey #用户名
read only = no
2.欢迎文件
[root@localhost test]# vi /etc/rsyncd.motd
welcome to rsync service of jackey!
3.密码文件
[root@localhost test]#vi /etc/rsyncd.secrets #密码文件权限为600,此步必须设置
jackey:jackey
4.chmod 600 /etc/rsyncd.*
5.运行rsync:
rsync --daemon /etc/rsyncd.conf
rsync的路径 rsync配置文件
Rsync client端相关配置
(1)安装rsync包 ----yum install rsync
(2)创建密码文件
[root@localhost ~]#vi /etc/rsyncd.secrets
test#客户端只需密码无须用户
注:此处密码一定要与rsync服务器端密码文件中密码保持一致,并且应为rsync客户端密码。
(3)chmod 600 /etc/rsyncd.secrets ----修改权限
