Sep 192010
 

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.[1] 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

DAV On

AuthType Basic

AuthName “webdav”

AuthUserFile /var/www/web1/passwd.dav

Require valid-user

[…]

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.

GnomeNautilus2Connecting to WebDAV server using Gnome Nautilus

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.

KDEKonquerorConnecting to WebDAV Server Using Konqueror

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.

Command line

Cadaver

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.

Examples:

cadaver http://dav.example.com/

Connects to the server myserver.example.com, opening the root collection.

cadaver http://zope.example.com:8022/Users/fred/

Connects to the server zope.example.com using port 8022, opening the collection “/Users/fred/”.

cadaver https://secure.example.com/

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

davfs2

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

Install: with sudo aptitude install davfs2.

Reconfigure the package since it needs to run suid if normal users should be able to use it: sudo dpkg-reconfigure davfs2

davfs2

After confirming to SUID davfs2 select a user group, e.g. “davfs2″:

davfs2-group

davfs2-infoscreen

make a mount point, i.e. a directory where the “file system” is hung into (directory webdav in a subdir of your home): mkdir ~/mnt/webdav

To testmount as root use something like (use quotes to tell bash to keep it’s hands off it): sudo mount.davfs 'http://domain.tld/davpath' /path/to/webdav

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 umount /path/to/webdav

From the man page:

If a proxy must be used this should be configured in /home/filomena/.davfs2/davfs2.conf
proxy proxy.mycompany.com:8080
Credentials are stored in /home/filomena/.davfs2/secrets
proxy.mycompany.com filomena “my secret”
http://webdav.org/dav webdav-username password

Reference: http://sysblogd.wordpress.com/2007/09/09/ubuntu-mounting-remote-filesystem-using-davfs2-fuse/

Popular Posts:

Flattr this!

  One Response to “WebDAV on linux”

  1. Hello, this is exactly what i need! I am using Gnome Nautilus. U type there to put username and password if needed.
    There is no field with password. SO i got the message access was denied.
    To understand, the webDav is provided by an exernal, so i only have servername, port, username and password.

 Leave a Reply

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

(required)

(required)

*