Apache webdav read write permissions

By | 2013-02-20

Howto grant different rights to users on webdav shares

Using webdav is an easy way to share files over
HTTP(S). The Apache Webserver has the modules included. The caveat is the grant concept inside DAV. Under Linux all files are owned by the apache user e. g. www-data, so it is not possible to work with file system rights like MS IIS. If the share ist read only or every autenticated user can write, no problem. But what’s about granting different read or write rights to differnet users ? Here is my solution.

        Alias /share /srv/webdav/share
        <Directory /srv/webdav/share/>
                # DAV client
                DAV             On
        </Directory>
        <Location /share/>
                AuthType        Basic
                AuthName        "WebDav share"
                AuthUserFile    /srv/webdav/webdav.user

                # read and write for authenticated user
                <Limit GET HEAD OPTIONS PROPFIND>
                        Require user write_user read_user
                </Limit>

                # write only for _write_user
                <LimitExcept GET HEAD OPTIONS PROPFIND>
                        Require user write_user
                </LimitExcept>

                # make it Browser readonly
                Options +Indexes
                IndexIgnore ..
                IndexOptions -IconsAreLinks NameWidth=* FancyIndexing SuppressLastModified FoldersFirst
                IndexOrderDefault Ascending Name
        </Location>

That’s it. After that you test your configuration with apache2ctl configtest. Is everthing OK than run it apache2ctl graceful.

Tom

One thought on “Apache webdav read write permissions

  1. Danie

    Found this solution as the only one working from the many, many ideas I’ve tried before this. Thank you!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

4 + 1 =