Mount box.net on Ubuntu Linux via webDAV

I recently signed up for a free 50gb account at Box.net. At the time of this writing, Box.net does not have an application to sync files from a Linux machine to their servers. I followed this guide and this post to mount the service to a local directory. I did:

<pre class="src src-sh">sudo apt-get install davfs2

emacs -q -nw /etc/davfs2/secrets ## added the following to the end of the file: “https://www.box.net/dav username password” mkdir /mnt/box.net ## added the following to /etc/fstab ## following equivalent to defaults except noauto instead of auto; http://www.tuxfiles.org/linuxhelp/fstab.html https://www.box.net/dav /mnt/box.net davfs rw,suid,dev,exec,noauto,nouser,async,uid=vinh,gid=vinh 0 0

Now do sudo mount /mnt/box.net to have have it mounted. Note that the account will automatically mount at startup.

Input/Ouput error

If you get an input/output error when copying files to your box.net folder, then add the following to your /etc/davfs2/davfs2.conf (per this post):

use_locks       0

Automount

I have the noauto option in /etc/fstab because I don’t want the box.net directory to be mounted at boot time. Why? Mounting requires an internet connection, and a network cable might not always be plugged; a mount error would require manual intervention (Skip or Manual mount) at startup. Instead, we should automatically mount the box.net directory whenever a network connection is made by placing the following script,

#! /bin/bash

mount /mnt/box.net

as /etc/network/if-up.d/mountBoxDotNet; remember to make it executable with chmod +x.