17 C

How to Set up WebDAV with Apache on CentOS 7

WebDAV (Web-based Distributed Authoring and Versioning)

is an augmentation of the HTTP convention that enables clients to alter and oversee reports and files put away on web servers.

WebDAV gives a system to clients to make, change, move, transfer, and download archives on an Apache web server. This settles on WebDAV a famous decision for designers, particularly when joined with Subversion or Git.

You can without much of a stretch mount WebDAV’s information stockpiling to the neighborhood filesystem. This should be possible with the mount command or with a WebDAV-bolstered file administrator, for example, Nautilus or Konqueror.

- Advertisement -

In this article I will clarify some fast and simple strides to set up WebDAV with Apache on CentOS 7


  • A server have running CentOS 7 with Apache installed
  • A static Public IP address for your server

Install the WebDAV module

The WebDAV module is included with the apache2 installation in CentOS 7, and is enabled by default. You can verify that the WebDAV module is running by using the following command:

sudo httpd -M | grep fs

If WebDAV is enabled, you will see the following output:

dav_fs_module (shared)

Configure the WebDAV directory

After installing the WebDAV module, you will need to create a webdav directory. Here, we will create the webdav directory under the Apache web root directory.

sudo mkdir /var/www/html/webdav

Next, change the ownership (to the apache user) and the permissions for the webdav directory with the following commands:

sudo chown -R apache:apache /var/www/html/webdav
sudo chmod -R 755 /var/www/html/webdav

Set up password authentication

It is important to secure your webdav directory with a password. You can do this by creating an .htpasswd file.

To create it, run the following command:

sudo htpasswd -c /etc/httpd/.htpasswd dev

This will create a password file for the user dev.

Now, you need to assign group ownership of the file to the apache user, and lock down the permissions for everyone else. To do this, run the following command:

sudo chown root:apache /etc/httpd/.htpasswd
sudo chmod 640 /etc/httpd/.htpasswd

Configure an Apache vhost for WebDAV

Next, you need to create a virtual host file for the webdav directory. Start by creating a new site configuration file called webdav.conf.

sudo nano /etc/httpd/conf.d/webdav.conf

Add the following content:

DavLockDB /var/www/html/DavLock
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/webdav/
    ErrorLog /var/log/httpd/error.log
    CustomLog /var/log/httpd/access.log combined
        Alias /webdav /var/www/html/webdav
        <Directory /var/www/html/webdav>
            DAV On
            AuthType Basic
            AuthName "webdav"
            AuthUserFile /etc/httpd/.htpasswd
            Require valid-user

Now, restart Apache to activate the new configuration:

sudo apachectl restart

Test WebDav

Finally, WebDAV is ready for testing. Here, we will use a browser and a client to check WebDAV.

Test with a web browser

To test whether the authentication is working correctly or not, open your web browser and navigate to the URL http://your.server.ip/webdav/.


You will be prompted for a user name and password to access WebDAV. Here, you will need to enter the user name and password we set before.


Test with a command line client

Here, we will use a WebDAV client called Cadaver. To install Cadaver, use the command below:

sudo yum --enablerepo=epel install cadaver

After installing Cadaver, you can test your WebDAV using the command below:

cadaver http://your.server.ip/webdav/


If all went well, you will be asked to enter your user name and password for WebDAV. Then, You should be granted access which means that WebDAV is working correctly.

Some useful Cadaver command examples are listed below:

To upload a file to WebDAV:

dav:/webdav/> put filename

To view/list the contents on WebDAV:

dav:/webdav/> ls

To create a new directory and navigate to it:

dav:/webdav/> mkdir new-dir
dav:/webdav/> cd new-dir

Once you are done, you can exit using the below command:

dav:/webdav/> exit


- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article