@ERROR: chdir 失败但目录存在

Gre*_*g B 5 rsync busybox

我有一个 D-Link DNS-320,我已经安装了 FFP,我正在尝试rsync运行它。

到目前为止,我已经启动并运行了守护程序,并且我已经定义了一个模块,rsyncd.conf如下所示:

max connections = 10
secrets file = /ffp/etc/rsyncd.secret

use chroot = false
read only = no
list = true
strict modes = false
#hosts deny = *
timeout = 600
dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz *.mkv *.avi *.mpg *.jpg *.rar
pid file = /var/run/rsyncd.pid
reverse lookup = no

[root]
hosts allow = *
read only = false
gid = allaccount
uid = nobody
auth users = greg
path = /mnt/HD/HD_a2/rsync
comment = Fish
list = yes
Run Code Online (Sandbox Code Playgroud)

/mnt/HD/HD_a2是内部磁盘并且/mnt/HD/HD_a2/rsync存在:

root@nas:/mnt/HD/HD_a2/rsync# pwd  
/mnt/HD/HD_a2/rsync
Run Code Online (Sandbox Code Playgroud)

具有以下权限:

root@nas:/mnt/HD/HD_a2# ls -la
total 154589
drwxrwxrwx 23 root   root            4096 Oct  2 19:44 .
drwxr-xr-x  3 root   root            1024 Oct  2 17:20 ..
drwxrwxrwx  4 root   root            4096 Dec 29  2013 Ajaxpf
drwxrwxrwx 21 nobody allaccount      4096 Oct  2 15:45 NAS
dr-xr-xr-x  4 root   root            4096 Sep 24 17:45 Public
drwxr-xr-x  3 root   root            4096 Sep 24 17:45 Users
drwxr-xr-x 17 root   root            4096 Aug 27 14:11 ffp
-rw-r--r--  1 root   root            1117 Oct  2 17:20 ffp.log
-rwxr-xr-x  1 root   root            1942 Sep 23 17:29 fun_plug
drwxr-xr-x  2 root   root            4096 Jul 15  2012 logs
drwxrwxrwx  2 nobody allaccount      4096 Oct  2 21:09 rsync
Run Code Online (Sandbox Code Playgroud)

greg在我的rsync.secret文件中定义了用户,我可以从我的(Windows)客户端成功连接并列出模块:

C:\Batch\rsync> rsync greg@nas::  
root            Fish
Run Code Online (Sandbox Code Playgroud)

然而; 当我尝试发送文件时,我得到@ERROR: chdir failed

C:\Batch\rsync> rsync -vvvv SRC test.txt greg@nas::root/test.txt  
opening tcp connection to nas port 873  
Connected to nas (192.168.10.5)  
note: iconv_open("UTF-8", "UTF-8") succeeded.  
sending daemon args: --server -vvvve.Lsf . root/test.txt  
@ERROR: chdir failed  
[sender] _exit_cleanup(code=5, file=/usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/main.c, line=1516): entered  
rsync error: error starting client-server protocol (code 5) at /usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/main.c  
(1516) [sender=3.0.9]  
[sender] _exit_cleanup(code=5, file=/usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/main.c, line=1516): about to call
 exit(5)
Run Code Online (Sandbox Code Playgroud)

rsync在客户端使用 Cygwin 3.0.9rsync版,在服务器上使用 3.1.0 版。

在服务器上,rsync以 root 身份运行:

root@nas:/mnt/HD/HD_a2# ps aux | grep rsync  
root     10074  0.0  0.3   1996   376 ?        Ss   21:57   0:00 /ffp/bin/rsync --daemon --config=/ffp/etc/rsyncd.conf --log-file=/var/log/rsync.log --ipv4 -vvvv
Run Code Online (Sandbox Code Playgroud)

为什么chdir失败?

root可以写信给/mnt/HD/HD_a2/rsync

root@nas:/mnt/HD/HD_a2/rsync# touch /mnt/HD/HD_a2/rsync/touch  
root@nas:/mnt/HD/HD_a2/rsync# ls -la  
total 8  
drwxrwxrwx  2 nobody allaccount 4096 Oct  2 22:21 .  
drwxrwxrwx 23 root   root       4096 Oct  2 19:44 ..    
-rw-r--r--  1 root   root          0 Oct  2 22:21 touch  
Run Code Online (Sandbox Code Playgroud)

rsync作为root.

服务器上的日志没有任何用处:

2014/10/02 22:19:35 [10391] rsyncd version 3.1.0 starting, listening on port 873  
2014/10/02 22:19:41 [10394] connect from UNDETERMINED (192.168.10.37)  
Run Code Online (Sandbox Code Playgroud)

那么为什么会chdir失败呢?或者如何进一步诊断问题?

更新 #1

关于这是配置匿名 rsync 守护程序的副本,但与 SELinux 相关的解决方案是问题所在。DNS-320 运行嵌入式、精简版的 Linux,其中不包括 SELinuxgetenforcesetenforce命令,所以如果是这样,如评论中建议的,我该如何纠正?

既然这些工具都不可用,那还能是什么?

Per*_*t64 2

我刚刚在 QNAP 设备上遇到了这个问题,并出现此错误;

ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(2547) [Receiver=3.0.7]
Run Code Online (Sandbox Code Playgroud)

我以一种奇怪的方式解决了这个问题,将 rsync.conf 文件编辑为

use chroot = true
Run Code Online (Sandbox Code Playgroud)

初始同步完成后,我将其设置回

use chroot = false
Run Code Online (Sandbox Code Playgroud)

现在它起作用了。