Search code examples
rsync

How to fix rsync's @ERROR: chdir failed error on a Mac


I am using OSX (Catalina) and I am trying to sent rsync up and I am failing at it.

I have the following configuration:

port = 3001
pid file = /path/to/pid.log
lock file = /path/to/rsync.lock
log file = /path/to/rsync.log


[repo]
path = /path/to/dir/
comment = This a directory
read only = yes
list = yes
use chroot = false # used true, same result
use chdir = false # used true, same result

Attempting to list by running:

rsync -rdt rsync://IPADDR:RsyncPort/

or attempting to copy a file by running:

rsync -rdt rsync://IPADDR:RsyncPort/DirectoryName/File /DestinationDirectory/

Always leads to same error:

@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-54/rsync/main.c(1402) [receiver=2.6.9]

What am I doing wrong? How can this be fixed?


Solution

  • The problem was I forgot to create the dir in /path/to/dir/. In my research I found two reasons that could be responsible for this error. Either permission issues, or the file/directly does not exist. In my case it was the directory not existing, and rsync does not report a useful descriptive error message.

    I thought of deleting this question, but I guess this can be useful to someone else.