首页 > 其他 > 详细

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

时间:2018-02-04 20:44:56      阅读:325      评论:0      收藏:0      [点我收藏+]
一直觉得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

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

原文:http://blog.51cto.com/13466287/2068676

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!