daily system administration

Linux, Debian and the rest
any questions or comments: Tom@d7031.de

Apache webdav read write permissions

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
        <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

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

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

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