Red Hat / CentOS Linux: Apache Enable WebDAV

Q. Web-based Distributed Authoring and Versioning ( WebDAV) - is a set of extensions to the Hypertext Transfer Protocol (HTTP) that allows users to collaboratively edit and manage files on remote World Wide Web servers. How do I enable WebDAV under CentOS / RHEL 5 Linux server?

A. WebDAV can be easily created under httpd. All you have to do is add following directive alias.

httpd Dav on

Open httpd.conf file:
# vi httpd.conf
Append following directive:

Alias /webdav /home/httpd/webdav
Dav on

Save and close the file. Update: here is my sample /etc/httpd/conf.d/webdav.conf file. Instead of putting above two lines in httpd.conf, create /etc/httpd/conf.d/webdav.conf as follows:

 <IfModule mod_dav.c>
    LimitXMLRequestBody 131072
 
    Alias /webdav "/home/httpd/webdav"
    <Directory /home/httpd/webdav>
        Dav On
        Options +Indexes
        IndexOptions FancyIndexing
        AddDefaultCharset UTF-8
        AuthType Basic
        AuthName "WebDAV Server"
        AuthUserFile /etc/httpd/webdav.users.pwd
        Require valid-user
        Order allow,deny
        Allow from all
    </Directory>
 </IfModule>

The configuration file will automatically be included. Run following to create user and password for user called tom:
# htpasswd -c /etc/httpd/webdav.users.pwd tom
You need to enter a password. The -c option creates the /etc/httpd/webdav.users.pwd. It can be left out when others users are added to the database. Now, create /home/httpd/webdav and set ownership:
# mkdir -p /home/httpd/webdav
# chown apache:apache /home/httpd/webdav

Finally, restart apache, enter:
# /etc/init.d/httpd restart

How do I access WebDAV in Windows / Linux / UNIX and Mac OS X?

Windows XP / 2003 server or higher have WebDAV client. Open My network places and click Add network place. Enter the WebDAV URL (e.g. http://yourdomain.com/webdav).

WebDAV in OS X

Click Finder > From the Finder menu, select Go > Connect to Server.

Type in the URL (e.g. http://yourdomain.com/webdav), and press the + button to save it as a favourite. Finally, provide username and password.

WebDAV in Linux / UNIX

Use GUI file manager.

KDE supports WebDAV by just using URLs that start with webdav:// or webdavs://. For e.g, open konqueror and type the url webdav://yourdomain.com/webdav

The Gnome file browser Nautilus also has WebDAV support in recent versions, using normal URLs with http://. Open Nautilus and type the url http://yourdomain.com/webdav.

Command-line WebDAV client for Unix / Linux

Use cadaver client, it supports file upload, download, on-screen display, namespace operations (move and copy), collection creation and deletion, and locking operations. Its operation is similar to the standard ftp client and the Samba Project’s smbclient. A user familiar with these tools should be quite comfortable with cadaver. cadaver supports automatically logging in to servers requiring authentication via a .netrc file (similar to ftp).

To onnect to webdav server, from a shell prompt enter:
$ cadaver http://your-server.com/webdav

References:

  • webdav
  • man page httpd.conf and cadaver
Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 8 comments… read them below or add one }

1 Manoj 12.03.08 at 12:41 pm

getting error while restarting my apache
[root@testbox ~]# /etc/init.d/httpd restart
Stopping httpd: [FAILED]
Starting httpd: Syntax error on line 555 of /etc/httpd/conf/httpd.conf:
DAV not allowed here
[FAILED]
[root@testbox ~]#

2 Manoj 12.03.08 at 12:45 pm

menting “Dav on” under would work

———–
Alias /webdav /home/httpd/webdav

Options None
AllowOverride None
Order allow,deny
Allow from all
Dav on

=======================

3 Jason 12.03.08 at 7:04 pm

I think this article is missing something and the comments tried to clean it up, but they too didn’t work on my CentOS system. Put the following in a file /etc/httpd/conf.d/webdav.conf and then reload httpd.

Alias /webdav /home/httpd/webdav/

Options None
AllowOverride None
Order allow,deny
Allow from all
Dav on

4 Jason 12.03.08 at 7:05 pm

How do we provide for authentication? Do you recommend just using an .htaccess file?

5 vivek 12.03.08 at 7:17 pm

@Manoj / Jason,

The faq has been updated to fix the problem. Let me know if you need anything else.

6 Jason 12.03.08 at 7:36 pm

Thanks for the update. Your website has been so helpful. One more tip: if you’re doing WebDAV over the Internet and using authentication (which you should) be sure to enable HTTPS to protect those passwords.

7 John Paul 12.29.08 at 2:30 pm

Hi

I am wondering if this is possible;

read only for everyone, and only write access for people allowed to modify the site.

im in the process of rebuilding a website and will be using Adobe Contribute for 3 staff to update the site, but it will need to be publically viewable, but only writable by 3 staff, is this easy to acomplish?

8 akuba 03.13.09 at 3:06 pm

thanks!

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tagged as: , , , , , , ,

Previous post: FreeBSD Obtain and Install Ports File in /usr/ports

Next post: Tar Extract a Single File(s) From a Large Tarball