Sunday, September 20, 2009

Accessing WebDAV Filespace from Linux

First, you must install the WebDAV Linux file system driver on your Linux computer. It is recommended to use a fairly new version of davfs2 (e.g., 1.1.4 or later). Early versions have severe security problems.
Download and Installation
First check whether your Linux distribution comes with a precompiled version of davfs2. If it does, simply install the package and your are done with the installation. If your Linux distribution does not contain a davfs2 package, it is not difficult to compile the driver yourself:
  • First get the source code from the WedDAV download site and download the latest version available (at the time of writing this was 1.1.4). Save the tar file at a suitable location, e.g., /tmp.
  • Make sure that you have the neon and neon-devel packages installed.
  • Untar the downloaded tarball at a suitable location (I prefer /usr/local/src), change to the directory (e.g., cd /usr/local/src/davfs2-1.1.4) and run the following commands: "./configure", "make", "make install" (you must become root before running the "make install" command). This will install the driver in the /usr/local/directory tree, e.g., the mount.davfs command will get installed in /usr/local/sbin.

Mounting WebDAV Directories

First you must create the mount point for your WebDAV directories, i.e., an empty directory that will after the mount hold your WebDAV files. I prefer to create a directory "webdav" in the home directory on my Linux computer and create within that directory suitably named subdirectories that will serve as mount points for your webdav directories. Then you can mount your webdav file space by typing something like
su
mount.davfs -ouid=partha,gid=users https://webdav.url.com/files/personal/partha /home/patha/backup
exit

where the first argument, -ouid=partha,gid=users specifies your username and group on your own Linux computer, i.e., replace "partha" with your own username and replace "users" with your group (execute the command "id -n -g" to find your group, if you are not sure). The second argument, https://webdav.url.com/files/personal/partha

in this example, specifies the location of your webdav file space on the WebDAV server. The last argument is the mount point that you created before, i.e., the name of the directory that is going to hold your WebDAV files. The mount.davfs (in CentOS I had to do /sbin/mount.davfs in place of mount.davfs) command is going to ask you for a username and password. These are your SFU username and password - not the username and password that you are using for your Linux computer.

If everything goes well, you now can access your WebDAV files in the directory that you chose as the mount point.

TroubleShooting:

_____________________

Incase you get
/sbin/mount.davfs: Mounting failed.
401 Unauthorized

the webdav server may be Windows and you need to enable Basic Authentication through IIS in the server

______________________________________

______________________________________

Incase you get the error

/sbin/mount.davfs: can’t open fuse device
/sbin/mount.davfs: trying coda kernel file system
/sbin/mount.davfs: no free coda device to mount

You may need to install
fuse fuse-ntfs-3g dkms dkms-fuse

In CentOS box I simply did

yum install fuse fuse-ntfs-3g dkms dkms-fuse


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.