views:

99

answers:

1

Hi there,

On a mountpoint (specifically: /var/data/) I have mounted a 3tb raid partition that stores all kind of data and I would like to share it through WebDAV. So I installed davfs2 on my client and set up the server site by adding:

ScriptAlias "/var/www/webdav" "/var/data"
<Directory "/var/www/webdav">
   Dav On
</Directory>

Finally I added the www-data user to the media group, which is the group that has read/write access to all the /var/data stuff (file mode for all contents is 660, chown is "some_owner_which_is_part_of_media:media").

Then a a2enmod mod_dav and a restart of the apache should arise it to life. Ok, fine until here. I mounted the davfs on my client pc and it worked like a glance. At least it looked like that. The contents were listed and I was happy. Later I tried to open some file on my client, but sadly it failed with an IO error. And here the problems begin.

==> /var/log/apache2/access.log <==
jin.local - - [26/Jun/2010:14:04:45 +0200] "PROPFIND /webdav/ HTTP/1.1" 207 25152 "-" "davfs2/1.4.5 neon/0.29.0"
jin.local - - [26/Jun/2010:14:04:46 +0200] "GET /webdav/test HTTP/1.1" 500 823 "-" "davfs2/1.4.5 neon/0.29.0"

==> /var/log/apache2/error.log <==
[Sat Jun 26 14:04:46 2010] [error] [client 192.168.2.50] (13)Permission denied: exec of '/var/data/test' failed
[Sat Jun 26 14:04:46 2010] [error] [client 192.168.2.50] Premature end of script headers: test

In the assumption it might be a problem with the permissions that apache2 has no right to access this stuff I swiftly chowned the files and therefore I am quite sure it must be fine like this:

# ls -la /var/data
-rw-r--r--  1 www-data www-data   22 2010-06-27 10:07 anotherTest
-rw-r--r--  1 www-data www-data    5 2010-06-26 19:28 test
# cat anotherTest
this is another test
# cat test
test

Lately I also added authentication, in case WebDAV could need that to allow me the GET request. The authentication works but the rest just stays the same.

At this point I don't know what I could change. Anyone got an idea what I could try?

Greetings, D.

-- EDIT --

some more log stuff and the current configuration. i just dont get what is wrong with it. as you can see in the log i can create (PUT) and delete (DELETE) files. but get just doesnt work.

ScriptAlias /webdav/ /test/
        <Location /webdav/>
                DAV On
                AuthType Basic
                AuthName "Restricted Files"
                AuthBasicProvider file
                AuthUserFile /var/www/passwords
                AuthGroupFile /var/www/groups
                <LimitExcept PROPFIND>
                         require group webdav
                </LimitExcept>
        </Location>

This is so odd?!

192.168.2.158 - - [02/Jul/2010:21:11:38 +0200] "GET /webdav/test HTTP/1.1" 500 823 "-" "-"
192.168.2.158 - - [02/Jul/2010:21:11:38 +0200] "GET /webdav/test HTTP/1.1" 500 823 "-" "-"
192.168.2.158 - dominik [02/Jul/2010:21:11:39 +0200] "PROPFIND /webdav/ HTTP/1.1" 207 1882 "-" "-"
192.168.2.158 - - [02/Jul/2010:21:11:39 +0200] "GET /webdav/test HTTP/1.1" 500 823 "-" "-"
192.168.2.158 - - [02/Jul/2010:21:11:39 +0200] "GET /webdav/test HTTP/1.1" 500 823 "-" "-"
192.168.2.158 - - [02/Jul/2010:21:11:39 +0200] "GET /webdav/test HTTP/1.1" 500 823 "-" "-"
192.168.2.158 - dominik [02/Jul/2010:21:11:42 +0200] "PROPFIND /webdav/.test.swp HTTP/1.1" 404 467 "-" "-"
192.168.2.158 - dominik [02/Jul/2010:21:11:42 +0200] "PUT /webdav/.test.swp HTTP/1.1" 201 481 "-" "-"
192.168.2.158 - dominik [02/Jul/2010:21:11:42 +0200] "DELETE /webdav/.test.swp HTTP/1.1" 204 141 "-" "-"
192.168.2.158 - dominik [02/Jul/2010:21:11:45 +0200] "PROPFIND /webdav/ HTTP/1.1" 207 497 "-" "-"

==> /var/log/apache2/private-error.log <==
[Fri Jul 02 21:11:38 2010] [error] [client 192.168.2.158] (13)Permission denied: exec of '/test/test' failed
[Fri Jul 02 21:11:38 2010] [error] [client 192.168.2.158] Premature end of script headers: test
[Fri Jul 02 21:11:38 2010] [error] [client 192.168.2.158] (13)Permission denied: exec of '/test/test' failed
[Fri Jul 02 21:11:38 2010] [error] [client 192.168.2.158] Premature end of script headers: test
[Fri Jul 02 21:11:39 2010] [error] [client 192.168.2.158] (13)Permission denied: exec of '/test/test' failed
[Fri Jul 02 21:11:39 2010] [error] [client 192.168.2.158] Premature end of script headers: test
[Fri Jul 02 21:11:39 2010] [error] [client 192.168.2.158] (13)Permission denied: exec of '/test/test' failed
[Fri Jul 02 21:11:39 2010] [error] [client 192.168.2.158] Premature end of script headers: test
[Fri Jul 02 21:11:39 2010] [error] [client 192.168.2.158] (13)Permission denied: exec of '/test/test' failed
[Fri Jul 02 21:11:39 2010] [error] [client 192.168.2.158] Premature end of script headers: test
A: 

I could bang my head. The solution was simple:

Alias /webdav/ /var/data/
<Location /webdav/>
        DAV On
        AuthType Basic
        AuthName "Restricted Files"
        AuthBasicProvider file
        AuthUserFile /etc/passwords
        AuthGroupFile /etc/groups
        <LimitExcept PROPFIND>
                 require group webdav
        </LimitExcept>
</Location>

Note the "Alias" in the place of "ScriptAlias". The reason why this works can be found here.

Nachbars Lumpi