Bug 9823 - Permission denied as root when no read for other
Summary: Permission denied as root when no read for other
Status: RESOLVED INVALID
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.0.6
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-22 09:00 UTC by Laurent G
Modified: 2013-04-22 14:35 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent G 2013-04-22 09:00:47 UTC
ISSUE:
When I'm running rsync as root (daemon and client sides) on a directory with no rights for other (chmod 750), I get an error message: "failed: Permission denied (13)"
Is it the expected behaviour for rsync? 

HOW TO REPRODUCE:
Make a test directory to share with rsync:
    # id
    uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
    # mkdir /test/
    # touch /test/myNiceFile
Remove the rights for Other:
    # chmod o-rx /test/
    # ls -al /test/
    total 8
    drwxr-x---.  2 root root 4096 Apr 18 13:31 .
    dr-xr-xr-x. 25 root root 4096 Apr 18 13:31 ..
    -rw-r--r--.  1 root root    0 Apr 18 13:31 myNiceFile
Edit the config file
    # cat /etc/rsyncd.conf
    [test-rsync]
        path    = /test/
Start the daemon as root:
    # rsync --daemon
Run the sync (on the localhost) also as root:
    # rsync -avzH localhost::test-rsync /tmp/
    receiving incremental file list
    rsync: change_dir "/" (in test-rsync) failed: Permission denied (13)
    sent 4 bytes  received 6 bytes  20.00 bytes/sec
    total size is 0  speedup is 0.00
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1505) [receiver=3.0.6]

I was able to reproduce on RHEL 5.8, Fedora 18, Debian 6.0 and Ubuntu 10.04.
Comment 1 Laurent G 2013-04-22 09:04:00 UTC
I also tested on RHEL 6.3 and get the same reaction.
Comment 2 Paul Slootman 2013-04-22 11:16:32 UTC
I recommend just using the mailing list for asking questions about using rsync. Abusing bugzilla for this is not very productive.

Your problem is that you either didn't read the documentation thoroughly, or didn't understand it. From the rsyncd.conf manpage:


uid    This parameter specifies the user name or  user  ID
       that  file transfers to and from that module should
       take place as when the daemon was run as  root.  In
       combination  with  the  “gid” parameter this deter-
       mines what  file  permissions  are  available.  The
       default  is  uid  -2,  which  is  normally the user
       “nobody”.

So even though you started rsyncd as root, it uses "nobody" by default for access.
Comment 3 Laurent G 2013-04-22 14:34:40 UTC
(In reply to comment #2)
> I recommend just using the mailing list for asking questions about using rsync.
> Abusing bugzilla for this is not very productive.
> 
> Your problem is that you either didn't read the documentation thoroughly, or
> didn't understand it. From the rsyncd.conf manpage:
> 
> 
> uid    This parameter specifies the user name or  user  ID
>        that  file transfers to and from that module should
>        take place as when the daemon was run as  root.  In
>        combination  with  the  “gid” parameter this deter-
>        mines what  file  permissions  are  available.  The
>        default  is  uid  -2,  which  is  normally the user
>        “nobody”.
> 
> So even though you started rsyncd as root, it uses "nobody" by default for
> access.

I just found the solution by myself when looking for something else. My mistake!
But you already replied! So thank you
I will directly close this case.