1

I'm trying to set up WebDAV on my CentOS 6.5 server which has Apache 2.2, and I'm having problems.

I'm following this guide here: http://www.howtoforge.com/how-to-set-up-webdav-with-apache2-on-centos-5.5

I have verified that the required mod_dav.so and mod_dav_fs.so modules are enabled.

I've created my virtual host entry, like so:

<VirtualHost 11.22.33.44:80>
SuexecUserGroup "#500" "#500"
ServerName dav.naijastories.com
DocumentRoot /home/myuser/public_html/
ScriptAlias /cgi-bin /home/myuser/public_html/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/myuser/public_html/>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/myuser/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/myuser/fcgi-bin/php5.fcgi .php5
</Directory>

Alias /webdav /home/myuser/public_html

<Location /webdav>
DAV On
AuthType Basic
AuthName "myuser"
AuthUserFile /home/myuser/.myuserpassfile
Require valid-user
</Location>

FcgidIOTimeout 600
</VirtualHost>

I've ensured that .myuserpassfile does contain the right creds for myuser.

I've restarted the Apache service after making these changes.

But when I navigate to dav.naijastories.com, I don't see anything that looks like a directory structure.

What am I doing wrong here?

EDIT:

I've made progress on this.

To make this clearer, I was actually trying to access the files on the CentOS machine easily from my Windows PC; I thought I would have to do this through my browser, but it turns out that it's easier to do this through Windows Explorer.

First of all, I changed the virtual host section to be like this:

<VirtualHost 11.22.33.44:80>
ServerName dav.mysite.com
DocumentRoot /home/myuser/public_html

<Directory /home/myuser/public_html>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
allow from all

DAV On
AuthType Digest
AuthName "dav"
AuthDigestDomain http://dav.mysite.com
AuthUserFile /home/myuser/.htdigest
Require valid-user
</Directory>

</VirtualHost>

Where:

  • 11.22.33.44 is the IP address of the host for the site;
  • dav.mysite.com (in ServerName) is a a subdomain of the main site which maps to the directory with the files to be shared via WebDAV;
  • /home/myuser/public_html (in DocumentRoot) is the directory with the files to be shared;
  • dav (in AuthName) is the first part of the subdomain;
  • /home/myuser/.htdigest is a file created using htdigest to hold the credentials of a user who will be authorized to access the files shared by WebDAV;
  • http://dav.mysite.com (in AuthDigestDomain) has exactly the same hostname as in ServerName.

Once I added this to the httpd.conf file and restarted apache, then on my Windows PC, I did the following:

  • Opened Windows Explorer;
  • Right-clicked 'Network' and clicked 'Map Network Drive';
  • In the 'Folder' field, typed http://dav.mysite.com (the same value as for AuthDigestDomain);
  • Selected 'Connect using different credentials;
  • Clicked 'Finish';
  • In the login box that appears, used the same credentials that I provided when creating the .htdigest file

I was able to log in and see my files once I did this.

However, I cannot write to the folders that I see in explorer.

Any time I do this, I get this message:

"An unexpected error is keeping you from creating the file. If you continue to receive this error, you can use the error code to search for help with this problem. Error 0x80070780: The file cannot be accessed by the system."

Looking at the apache logs, I see errors like these:

[Sun Nov 09 16:40:55 2014] [error] [client 11.22.33.44] client denied by server configuration: /home/myuser/public_html/.htaccess
[Sun Nov 09 16:40:55 2014] [error] [client 11.22.33.44] (13)Permission denied: access to /webdav/index.html denied
[Sun Nov 09 16:40:55 2014] [error] [client 11.22.33.44] (13)Permission denied: access to /webdav/index.html.var denied
[Sun Nov 09 16:40:56 2014] [error] [client 11.22.33.44] Unable to PUT new contents for /wptest/New Text Document.txt.  [403, #0]
[Sun Nov 09 16:40:56 2014] [error] [client 11.22.33.44] (13)Permission denied: An error occurred while opening a resource.  [500, #0]

I'm confused by these. There's nothing in my .htaccess file restricting access (I'm not even copying the file there), and I don't have a webdav directory on my machine.

Any ideas?

2
  • Hm. Looks like the problem is that the directory in the shared directory should have write permissions for both apache and the owner of the file. I wonder if there's a way of configuring WebDAV so that only the owner of the files needs to have write permissions. Nov 10, 2014 at 2:43
  • Look to SELinux security configuration wiki.centos.org/HowTos/SELinux
    – user299503
    Jul 15, 2015 at 9:27

0

You must log in to answer this question.

Browse other questions tagged .