linux rsync 常见错误,关于rsync共享服务的几个常见错误

一直觉得rsync是个配置很简单的服务软件,今天需要搭建一个rsync服务出现了一些小问题,特意写下接下来的内容

首先在服务器上搭建rsync

`#yum -y install rsync``

修改配置文件 /etc/rsyncd.conf 在尾部添加以下配置

[ftp] //这里和大多数共享服务配置一样需要定义一个用户名,名字由自己取

path = /home/ftp //这里是你需要共享出去的目录

comment = ftp export area //这里是共享描述

auth users = tom //这里是你希望通过什么用户共享这个目录和系统用户无关

secrets file = /etc/rsyncd_users.db //这里是指定共享的用户名和密码

重启服务并设置开机启动

#systemctl restart rsyncd

#systemctl enable rsyncd

在客户端访问rsync共享发现

#rsync 192.168.2.100:: //这里的ip是我共享服务器的ip

ftp ftp export area

可以看到我的共享了但是当我去访问共享目录的时候需要验证我输入密码发现报错误

#rsync susers@192.168.2.100::ftp

@ERROR: auth failed on module ftp

rsync error: error starting client-server protocol (code 5) at main.c(1516) [Receiver=3.0.9]

大概意思是认证失败在ftp这个模块上这个错误主要原因是没有读到用户名密码文件或者权限不足密码文件需要的权限设为600就行,我在这里是文件名写错了改好后继续访问

#rsync susers@192.168.2.100::ftp

@ERROR: chroot failed

rsync error: error starting client-server protocol (code 5) at main.c(1516) [Receiver=3.0.9]

这个错误主要是访问不到共享的文件夹,有可能是服务器文件夹不存在或者权限不够,我在这里是没有创建文件夹

创建好文件夹再访问

#rsync susers@192.168.2.100::ftp

rsync: opendir "/." (in ftp) failed: Permission denied (13)

drwxr-xr-x 14 2018/02/04 01:39:47 .

rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1518) [generator=3.0.9]

又报错了我的心有点碎了访问被拒绝,密码也对了,权限也够了问题出在哪里,selinux问题想了半天才想到

查看以下selinux的bool值

#getsebool -a | grep rsync

postgresql_can_rsync --> off

rsync_anon_write --> off

rsync_client --> off

rsync_export_all_ro --> off

rsync_full_access --> off

把 rsync_export_all_ro 只读设置为on

终于大功告成

rsync tom@192.168.2.100::ftp/

Password:

drwx-wx--x 14 2018/02/04 01:39:47 .

-rw-r--r-- 0 2018/02/04 01:39:47 a

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值