rsync: chdir /test failed : Permission denied (13)

11,071

Are you running SELinux? Could you paste the output of ls -lZ /test?

Share:
11,071

Related videos on Youtube

gokva
Author by

gokva

I spend my professional time working with Linux server technologies. Have made some minor contributions to some open-source projects on github; https://github.com/tolland

Updated on September 17, 2022

Comments

  • gokva
    gokva over 1 year

    I was trying to get a more complicated module rsyncing, but it seems that I cannot get the most basic example working...

    I have a very simple rsyncd.conf file with a single module running under xinetd;

    use chroot  = false
    strict modes = false
    hosts allow = *
    
    [thumbnails]
    path = /test
    read only = false
    

    The path has been created and has liberal permissions

        # ls -la /test/
        total 16
        drwxrwxrwx  2 root root 4096 Jul 12 21:50 .
        drwxr-xr-x 26 root root 4096 Jul 12 21:50 ..
    

    xinetd has been configured to run rsyncd as the root user (which was the default);

    # cat /etc/xinetd.d/rsync   
    # default: off
    # description: The rsync server is a good addition to an ftp server, as it \
    #       allows crc checksumming etc.
    service rsync
    {
            disable         = no
            socket_type     = stream
            wait            = no
            user            = root
            server          = /usr/bin/rsync
            server_args     = --daemon
            log_on_failure  += USERID
    }
    

    xinetd has been restarted;

    # service xinetd restart
    Stopping xinetd:                                           [  OK  ]
    Starting xinetd:                                           [  OK  ]
    

    However a simple rsync command to that module fails;

    # rsync -va /root/testfolder/ localhost::thumbnails
    @ERROR: chdir failed
    rsync error: error starting client-server protocol (code 5) at main.c(1296) [sender=2.6.8]
    
    
    Jul 12 21:55:23 opencirrus-i1106 xinetd[10142]: xinetd Version 2.3.14 started with libwrap
     loadavg labeled-networking options compiled in.
    Jul 12 21:55:23 opencirrus-i1106 xinetd[10142]: Started working: 1 available service
    Jul 12 21:55:27 opencirrus-i1106 xinetd[10142]: START: rsync pid=10147 from=127.0.0.1
    Jul 12 21:55:27 opencirrus-i1106 rsyncd[10147]: connect from localhost.localdomain (127.0.
    0.1)
    Jul 12 21:55:27 opencirrus-i1106 rsyncd[10147]: rsync: chdir /test failed : Permission den
    ied (13)
    Jul 12 21:55:27 opencirrus-i1106 xinetd[10142]: EXIT: rsync status=255 pid=10147 duration=
    0(sec)
    

    I am suspecting that rsync might be dropping permission from root to whatever process actually makes the rsync copy, but whatever it is I can't immediatly see what as the daemon, nobody and sync users can all cd and write in /test.

    If I run rsync from the command line eg;

    # rsync --daemon 
    # rsync -va /root/testfolder/ localhost::thumbnails
    

    this works fine.

    I tried the following modifications to the rsyncd.conf;

    # cat /etc/rsyncd.conf 
    use chroot  = false
    strict modes = false
    hosts allow = *
    
    [thumbnails]
    path = /test
    read only = false 
    uid = 501
    gid = 501
    

    where 501/501 is the uid/gid of a new user I created and chowned the /test folder to it, but I get the same problem.

    Other information

    Centos 5.4 x86_64
    # rsync -v
    rsync  version 2.6.8  protocol version 29
    

    additional info...

    # ls -alZ /test                 
    drwxr-xr-x  rsync-www rsync-www root:object_r:default_t          .
    drwxr-xr-x  root      root      system_u:object_r:root_t         ..
    -rw-r--r--  rsync-www rsync-www root:object_r:default_t          frontCover40X60.jpg
    -rw-r--r--  rsync-www rsync-www root:object_r:default_t          test
    -rw-r--r--  rsync-www rsync-www root:object_r:default_t          test2
    drwxr-xr-x  rsync-www rsync-www root:object_r:default_t          testdir
    -rw-r--r--  rsync-www rsync-www root:object_r:default_t          test.jpg
    drwxr-xr-x  rsync-www rsync-www root:object_r:default_t          tetxdir2
    drwxr-xr-x  rsync-www rsync-www root:object_r:default_t          tetxdir3
    
  • gokva
    gokva almost 14 years
    I have added it to the bottom of the post...
  • Jim
    Jim almost 14 years
    Looks like you are running SELinux though those perms look OK for the directory. I still think it's SELinux somehow. I'd set it to permissive and try a test run. You can disable it temporarily with this command setenforce 0 If it works, you may have to change the contexts for directories/files that xinetd is trying to use. To what, I don't know. I don't have enough experience with SELinux.