3

I set up rsync daemon on a Ubuntu server and I am trying to transfer a file from raspberry pi machine to the server:

rsync --timeout 10 --progress --password-file ~/rsync.password --append-verify some_file [email protected]::files
@ERROR: setgroups failed
rsync error: error starting client-server protocol (code 5) at main.c(1653) [sender=3.1.1]

I configured the rsync daemon to be run as pi user and I am getting the error above. If I run the daemon as root no errors are shown and transfer is ok.

Here is my rsyncd.conf file:

[files]
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsync.log

path = /some/path   
comment = RSYNC FILES
read only = false
secrets file = /etc/rsyncd.secrets
auth users = pi
uid = pi
gid = pi
use chroot = false

The path dir has g+s permissions set on it - I want all files in it to inherit parent directory's group.

Any ideas how to resolve this error?

1 Answer 1

3

I found the solution. Here is the problem. Since I am running the rsync daemon with another user, not root, I needed to give rsync the following capabilities:

setcap cap_net_bind_service,cap_setgid=+ep /usr/bin/rsync

  1. cap_net_bind_service - this is needed so the daemon can bind to the system ports(lower than 1024, the default port rsync is binding to is 873)
  2. cap_setgid - this is what caused the setgroups failed error.

Hope this helps someone in the future.

2
  • 1
    I can't thank you enough for this answer!! I've been pulling my hair out for the past few days getting this to work and this was the only solution that solved the issue. Thanks so much for sharing! I still can't grasp why rsync, an industry standard, is so poorly documented. As if this should be common knowledge...
    – Freek
    Dec 11, 2020 at 11:38
  • 1
    Glad I could help you :)
    – CuriousGuy
    Dec 11, 2020 at 11:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .