1

When trying to PUT an index.html file in the root of an already existing folder, nginx fails with:

[crit] 1181#0: *1 rename() "/opt/spool/nginx/client_temp/1/0000000001"
to "/opt/share/www/domain.tld/index.html-3hlCQ9iE" failed (13:
Permission denied), client: 1.2.3.9, server: host.domain.tld, request:
"PUT /www/domain.tld/index.html-3hlCQ9iE HTTP/1.1", host: "172.21.2.2"

Environment

  • Using nginx-extras 1.13.6-1 from entware-3x repo.
  • running on Padavan firmware.
  • $ grep www-rw /etc/passwd
    www-rw:x:1000:1001:Linux User,,,:/opt/share/www:/bin/sh
    
    $ grep www-w /etc/group
    www-w:x:1001:
    
    $ ls -l /opt/share/www
    drw-rw-r--    2 www-rw   www-w         4096 Feb  9 13:51 domain.tld
    
    $ ls -al /opt/share/www/domain.tld
    drw-rw-r--    2 www-rw   www-w         4096 Feb  9 13:51 .
    drwxr-xr-x    4 www-rw   www-w         4096 Feb  9 13:51 ..
    
    $ ls -l /opt/spool/nginx
    drwxrwxrwx    7 www-rw   root          4096 Feb  9 22:46 client_temp
    
    $ ls -l /opt/spool/nginx/client_temp
    drwx------    2 www-rw   www-w         4096 Feb  9 22:28 5
    
  • Client: Cyberduck/6.3.3.27341

  • Client-user: www-rw

Content of nginx.conf

user  www-rw www-w;
server {
    location /www {
        root                  /opt/share;

        client_body_temp_path /opt/spool/nginx/client_temp 1;
        dav_methods PUT DELETE MKCOL COPY MOVE;
        dav_ext_methods PROPFIND OPTIONS;
        # allow creating directories
        create_full_put_path  on;
        dav_access  user:rw  group:r  all:r;
        autoindex   on;
    }
}

Regression

  • user nobody nogroup;
  • dav_access user:rw group:r all:r;
  • #autoindex ...
  • Client-user: admin

What should I fix (in the permissions?) to resolve the Nginx dav permission denied errors?

3
  • Ownership/permissions on /opt/spool/nginx/client_temp ?
    – ivanivan
    Feb 9, 2018 at 23:28
  • ls -al /opt/share/www/domain.tld might help Feb 10, 2018 at 4:09
  • @ivanivan ls -l /opt/spool/nginx output is inserted. @GerardH.Pille ls -al /opt/share/www/domain.tld output is inserted too.
    – Pro Backup
    Feb 10, 2018 at 8:47

1 Answer 1

1
$ ls -l /opt/share/www
drw-rw-r-- 2 www-rw www-w 4096 Feb 9 13:51 domain.tld

Not specifically tested, but... add x (execute) permissions there.

That is:

chmod 775 /opt/share/www/domain.tld

or

chmod 755 /opt/share/www/domain.tld

x (execute permission) on a directory is needed for some things that you might naively think should only need w (write permissions).

Source: Francis Daly on Nginx mailing list 2018 February

1
  • 1
    Specifically, the x permission is needed to access the directory. The w permission is to create files, and r is for listing the contents.
    – Kusalananda
    Feb 11, 2018 at 21:41

You must log in to answer this question.

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