13

I configured a WebDAV server using Apache. Here is my configuration:

DAVLockDB /var/www/DAVLock.db

<Location /majid>
    AllowOverride None
    Options +Indexes
    DAV On
    AuthUserFile /var/www/users.db
    AuthName Authentication
    AuthType Basic
    <Limit GET PUT DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
        Require user majid
    </Limit>
</Location>

Alias /majid /var/www/dav/majid

/var/www/DAVLock.db is owned by apache user and group. I can access WebDAV share via browser. I have configured a WebFolder in Windows XP SP3. But I can't create file and folders. error_log file says:

[Tue Oct 11 17:05:12 2011] [error] [client 192.168.1.2] File does not exist: /var/www/dav/majid/New Folder
[Tue Oct 11 17:05:12 2011] [error] [client 192.168.1.2] The locks could not be queried for verification against a possible "If:" header.  [500, #0]
[Tue Oct 11 17:05:12 2011] [error] [client 192.168.1.2] Could not open the lock database.  [500, #400]
[Tue Oct 11 17:05:12 2011] [error] [client 192.168.1.2] (13)Permission denied: Could not open property database.  [500, #1]

Can anyone help? Another question is: Do we need Options +Indexes for WebDAV clients to list files and folders or it is only for web access using browser?

7 Answers7

8
ls -ld /var/www/
drwxr-xr-x. 9 root root 4096 Oct 11 15:54 /var/www/

chown -R apache:apache /var/www/, undo your change and try again.

quanta
  • 52,423
4

This was a gotcha for me, but according to the documentation for mod_dav:

"The directory containing the lock database file must be writable by the User and Group under which Apache is running."

You have to make sure you have proper permissions on both the DAV lock DB file and the directory containing it.

In my fresh installation, the /var/www/ directory did not have write permissions set for the apache group. The /var/lib/dav/ directory has these permissions set by default, which is why it worked for Majid. Knowing this, you make a directory somewhere of your choosing with the proper permissions.

(Old question, but it still came up in my search. I'm not a fan of configuration voodo, so for me it helps to know why Majid Azimi's config change worked for him.)

3

For the benefit of those who reach here from a search engine, another reason for this error is if the underlying apr-util DBM driver is missing / not installed. Usually this is resolved by installing the apr-util-bdb package via your package manager, but this varies from OS to OS.

The error handling has been fixed in (upcoming) apr-util v1.7, and will be available in a future version of httpd when apr-util is released.

http://svn.apache.org/viewvc?rev=1891018&view=rev http://svn.apache.org/viewvc?rev=1891019&view=rev

Edit: apr-util-lmdb has replaced apr-util-bdb in modern distros. You may also need to delete your existing lock file if the module changes.

Graham Leggett
  • 287
  • 3
  • 15
3

I removed this line:

DAVLockDB /var/www/DAVLock.db

and use the default configuration of Apache:

<IfModule mod_dav_fs.c>
    # Location of the WebDAV lock database.
    DAVLockDB /var/lib/dav/lockdb
</IfModule>

It is now working perfectly. But I don't know the reason yet.

1

This stopped working for me after a Fedora update. I simply deleted /var/lib/dav/lockdb and that fixed it. Apache recreated the file. Old file 12288 bytes, new file 8192 bytes. I guess the format changed and it did not understand the old one.

Joost
  • 11
  • 1
1

We also receiving same issues in Apache WebDav with CentOS 7 to fix this after changing the configuration we did

chcon -R -t httpd_sys_content_rw_t /var/www/{webdav root folder}

After this it works perfectly

Reference: https://sirion-notes.blogspot.com/2015/09/centos-7-apache-24-webdav-not-so-secure.html

0

I had the same issue when trying to edit document via MS Word. I deleted DavLockDB /usr/local/apache/var/DavLock line in apache2 config and it works.

It's not best approach but it works for now.

Dave M
  • 4,494
Yazdan
  • 1