WebDAV is always been one of my favorite protocol, because it permit to easily share file system and give user the permission of upload files, on the other side using it from Linux it’s always been a thorn while on Windows it works completely integrated with the OS.
What’s WebDAV ?
Web-based Distributed Authoring and Versioning (WebDAV) is a set of methods based on the Hypertext Transfer Protocol (HTTP) that facilitates collaboration between users in editing and managing documents and files stored on World Wide Web servers. WebDAV was defined in RFC 4918 by a working group of the Internet Engineering Task Force (IETF).
The WebDAV protocol makes the Web a readable and writable medium, in line with Tim Berners-Lee’s original vision. It provides a framework for users to create, change and move documents on a server (typically a web server or “web share”). The most important features of the WebDAV protocol include:
- locking (“overwrite prevention”)
- properties (creation, removal, and querying of information about author, modified date et cetera);
- name space management (ability to copy and move Web pages within a server’s namespace)
- collections (creation, removal, and listing of resources)
WebDAV on Apache
The server side of WebDAV is usually used in combination with Apache, it is one of the standard Apache modules, and then simply enable it in a Directory or a Location with directives such as:
Alias /webdav /var/www/web1/web
For a full how-to about this check: http://www.howtoforge.com/setting-up-webdav-with-apache2-on-debian-etch
Now i’ll show is a list of clients that you can use to work on WebDAV server, the most common use is to “mount” the remote url and than work on that like a local resource.
To connect to WebDAV server using Nautilus, in File menu select Connect to Server. In the Service Type field select WebDAV (HTTP) or Secure WebDAV (HTTPS) and fill in at last Server field, then if needed putting the username and password.
We will see a new folder on which we can work like a local directory.
To connect to WebDAV server using Konqueror, type the url in the address field starting with webdav:// for HTTP or starting with webdavs:// for HTTP/SSL.
You can also use Konqueror Location->Open Location menu.
cadaver is a command-line WebDAV client for Unix. It supports file upload, download, on-screen display, namespace operations (move/copy), collection creation and deletion, and locking operations.
Connects to the server myserver.example.com, opening the root collection.
Connects to the server zope.example.com using port 8022, opening the collection “/Users/fred/”.
Connects to a server called secure.example.com using SSL.
For a good example on automating operation of Cadaver with Expect i suggest this article: Using Expect and Cadaver to automate WebDAV uploads
Mount a WebDAV resource as a regular file system.
davfs2 provides the ability to access such resources like a typical filesystem, allowing for use by standard applications with no built-in support for WebDAV.
davfs2 is designed to fully integrate into the filesystem semantics of Unix-like systems (mount, umount, etc.). davfs2 makes mounting by unprivileged users as easy and secure as possible.
davfs2 does extensive caching to make the file system responsive, to avoid unnecessary network traffic and to prevent data loss, and to cope for slow or unreliable connections.
davfs2 will work with most WebDAV servers needing little or no configuration.
davfs2 is developed and tested on GNU/Linux but porting to other free operating systems should not be too cumbersome.
Example of configuration for a mount by a user
sudo aptitude install davfs2.
Reconfigure the package since it needs to run suid if normal users should be able to use it: sudo
After confirming to SUID davfs2 select a user group, e.g. “davfs2″:
make a mount point, i.e. a directory where the “file system” is hung into (directory webdav in a subdir of your home):
To testmount as root use something like (use quotes to tell bash to keep it’s hands off it):
To allow regular users access one needs to touch /etc/fstab to add a line like this one:
http://domain.tld/davapath /path/to/webdav davfs user,rw,noauto 0 0
Now any user (of group davfs2) can do mount
mount /path/to/webdav and
From the man page:
If a proxy must be used this should be configured in /home/filomena/.davfs2/davfs2.conf
Credentials are stored in /home/filomena/.davfs2/secrets
proxy.mycompany.com filomena “my secret”
http://webdav.org/dav webdav-username password