# [solved]Webdav: configuration error:  couldn't check access.

## elmar283

I've set up a webdav server following the https://forums.gentoo.org/viewtopic-t-338668-postdays-0-postorder-asc-highlight-dav-start-0.html instructions.

I'm having probrems connecting with a valid  user. I connect with the Finder (Go -> connect to server) in OS X 10.6.7.

I'll type in the following line to connect:

```
http://eotter1979.xs4all.nl/mydavserver
```

Then I'm asked for an password. After I'll typed my password I'll get an error message in /var/log/apache/error_log:

```

[Thu Jun 23 12:51:11 2011] [crit] [client 192.168.0.1] configuration error:  couldn't check access.  Check your 'Require' directive: /mydavserver/

```

I'll tried to connect without the Require valid-user and that worked perfectly, of course I don't want to connect without user authentication. But I'll know it's something with the authentication.

Does anyone why this happens?

This is my configuration:

/etc/conf.d/apache2

```

APACHE2_OPTS="-D DEFAULT_VHOST -D SSL_DEFAULT_VHOST -D INFO -D SSL -D PHP5 -D DNSSD -D DAV -D DAV_FS"

```

/etc/make.conf

```

CFLAGS="-O2 -march=native -pipe"

CXXFLAGS="${CFLAGS}"

MAKEOPTS="-j2"

# WARNING: Changing your CHOST is not something that should be done lightly.

# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.

CHOST="i686-pc-linux-gnu"

LINGUAS="nl nl_NL"

USE="apache2 acpi alsa autoipd avahi bonjour cdr curl cups dbus dvd exif expat fuse gd gs imagemagick imap jpeg jpeg2k libwww mdnsresponder-compat maildir mysql nls ntp pear pam pcre php python png $

APACHE2_MODULES="alias auth_basic auth_digest authn_default authn_file dav dav_fs dav_lock rewrite authz_host dir mime"

APACHE2_MPMS="prefork"

VIDEO_CARDS="radeon"

ALSA_CARDS="AC97"

GENTOO_MIRRORS="rsync://mirror.leaseweb.com/gentoo/ http://mirror.leaseweb.com/gentoo/ ftp://mirror.leaseweb.com/gentoo/ ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo http://ftp.snt.utwente.nl/pub/os$

SYNC="rsync://rsync.nl.gentoo.org/gentoo-portage"

```

My dav folder

```

elmarotter@masterserver /var/log/apache2 $ ls -la /var/dav             

total 16

drwxr-xr-x  3 apache apache 4096 Jun 23 12:28 .

drwxr-xr-x 16 root   root   4096 Jun 23 12:36 ..

-rw-r--r--  1 root   root     25 Jun 23 12:28 .davpasswd

drwxr-xr-x  2 apache apache 4096 Jun 22 20:27 mydavserver

```

/etc/apache2/modules.d/45_mod_dav.conf

```

<IfDefine DAV>

# DavLockDB "/var/lib/dav/lockdb"

# The following directives disable redirects on non-GET requests for

# a directory that does not include the trailing slash.  This fixes a

# problem with several clients that do not appropriately handle

# redirects for folders with DAV methods.

<IfModule setenvif_module>

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully

BrowserMatch "MS FrontPage" redirect-carefully

BrowserMatch "^WebDrive" redirect-carefully

BrowserMatch "^WebDAVFS/1.[012345678]" redirect-carefully

BrowserMatch "^gnome-vfs/1.0" redirect-carefully

BrowserMatch "^XML Spy" redirect-carefully

BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully

</IfModule>

<IfDefine DAV>

  <IfModule !mod_dav.c>

    LoadModule dav_module    modules/mod_dav.so

  </IfModule>

</IfDefine>

<IfDefine DAV_FS>

  <IfModule !mod_dav_fs.c>

    LoadModule dav_fs_module   modules/mod_dav_fs.so

  </IfModule>

</IfDefine>

<IfModule mod_dav.c>

    Alias /mydavserver /var/dav/mydavserver

    DavMinTimeout 600

        <Location /mydavserver>

                Options None

                Dav On

                <Limit GET PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>

                        AuthType Basic

                        AuthName "WebDAV Restricted Repository"

                        AuthUserFile /var/dav/.davpasswd

                        Require elmarotter

                        #Require valid-user

                </Limit>

        Order allow,deny

        Allow from all

        </Location>

</IfModule>                                                                                

<IfModule mod_dav_fs.c>

    # Location of the WebDAV lock database.

    DavLockDB /var/lib/dav/lockdb

</IfModule>

</IfDefine>

# vim: ts=4 filetype=apache

```

Last edited by elmar283 on Fri Jun 24, 2011 3:08 pm; edited 1 time in total

----------

## ponytaildude

mod_authz_user is required for 'Require valid-user'

Check output from 'apache2 -M'

You should see authz_user_module (shared)

----------

## elmar283

I have now added authz_user to my APACHE2_MODULES in /etc/make.conf. After that I did an emerge --deep --update --newuse world (apache was re-emerged) and restarted apache. 

I also found a possible configuration fault in my 45_mod_dav.conf. An <IfDefine) in an <IfDefine>. I fixed that. But it is still not working.

I read something about using <directory> instead of <location>. Does that change anything?

This is my new 45_mod_dav.conf

```
<IfDefine DAV>

  <IfModule !mod_dav.c>

    LoadModule dav_module    modules/mod_dav.so

  </IfModule>

</IfDefine>

<IfDefine DAV_FS>

  <IfModule !mod_dav_fs.c>

    LoadModule dav_fs_module   modules/mod_dav_fs.so

  </IfModule>

</IfDefine>

<IfModule mod_dav.c>

    Alias /mydavserver /var/dav/mydavserver

    DavMinTimeout 600

        <Location /mydavserver>

                Options None

                Dav On

                <Limit GET PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>

                        AuthType Basic

                        AuthName "WebDAV Restricted Repository"

                        AuthUserFile /var/dav/.davpasswd

                        Require elmarotter

                        #Require valid-user

                </Limit>

        Order allow,deny

        Allow from all

        </Location>

</IfModule>

<IfModule mod_dav_fs.c>

    # Location of the WebDAV lock database.

    DavLockDB /var/lib/dav/lockdb

</IfModule>

# vim: ts=4 filetype=apache

```

----------

## elmar283

These are the errors /var/log/apache2/error_log gives:

```

[Fri Jun 24 11:47:42 2011] [error] [client 192.168.0.1] Attempt to serve directory: /var/dav/mydavserver/

[Fri Jun 24 11:47:46 2011] [error] [client 192.168.0.1] Attempt to serve directory: /var/dav/mydavserver/

[Fri Jun 24 11:47:51 2011] [error] [client 192.168.0.1] Attempt to serve directory: /var/dav/mydavserver/

[Fri Jun 24 11:48:09 2011] [crit] [client 192.168.0.1] configuration error:  couldn't check access.  Check your 'Require' directive: /mydavserver/

```

Might it be something width read/write permissions? They look fine:

```

elmarotter@masterserver /var/dav/mydavserver $ ls -la /var/

total 64

drwxr-xr-x 16 root   root      4096 Jun 23 12:36 .

drwxr-xr-x 17 root   root      4096 Jun 16 18:24 ..

drwxr-xr-x  9 amavis mailusers 4096 Jun 16 18:40 amavis

drwxrwx---  5 root   named     4096 Jun  1 22:21 bind

drwxr-xr-x 14 root   root      4096 Jun 12 13:08 cache

drwxr-xr-x  3 apache apache    4096 Jun 23 12:28 dav

drwxr-xr-x  5 root   root      4096 Jun 24 11:24 db

drwxr-xr-x  2 root   root      4096 Jun  5 19:49 dcc

drwxr-xr-x  3 root   root      4096 Jun  1 08:16 empty

drwxr-xr-x 30 root   root      4096 Jun 12 14:57 lib

drwxr-xr-x  2 root   root      4096 Jun 24 03:10 lock

drwxr-xr-x 13 root   root      4096 Jun 16 18:39 log

lrwxrwxrwx  1 root   root        15 Jun  1 04:29 mail -> /var/spool/mail

drwxr-xr-x 19 root   root      4096 Jun 24 11:47 run

drwxr-xr-x  7 root   root      4096 Jun  3 16:25 spool

drwxrwxrwt  6 root   root      4096 Jun  5 10:06 tmp

drwxr-xr-x  3 root   root      4096 May 29 21:42 www

elmarotter@masterserver /var/dav/mydavserver $ ls -la /var/dav/

total 16

drwxr-xr-x  3 apache apache 4096 Jun 23 12:28 .

drwxr-xr-x 16 root   root   4096 Jun 23 12:36 ..

-rw-r--r--  1 apache apache   25 Jun 24 10:48 .davpasswd

drwxr-xr-x  2 apache apache 4096 Jun 22 20:27 mydavserver

elmarotter@masterserver /var/dav/mydavserver $ ls -la /var/dav/mydavserver/

total 8

drwxr-xr-x 2 apache apache 4096 Jun 22 20:27 .

drwxr-xr-x 3 apache apache 4096 Jun 23 12:28 ..

```

----------

## ponytaildude

Remove the:

Require elmarotter

and uncomment:

Require valid-user

from 45_mod_dav.conf

----------

## elmar283

Thank you. It is working now.  :Smile: 

----------

