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.

About Vinh Nguyen

Statistician

16 comments

  1. Automount

    in fstab you can add option ‘_netdev’ – the fstab then will know that’s a network device, and will mount after network is up

  2. Cool to be able to mount 50Gb of cloud storage :-) I’ve successfully been able to mount using the steps above … but I am prompted for an e-mail address and a password … even though I have added it to /ets/davfs2/sectrets

    Could that be related to the uid and gid in /etc/fstab? I have changed it to uid=1000,gid=1000 because that is the uid and gid of the user I’m logged in with.

    Is there a service that need to be restarted before I can successfully mount with the stored credentials?

  3. @Jorgen – sudo chmod -R 777 /media/Box (or wherever you mounted it) Then you’ll have read/write permissions on everything in your Box.

  4. Hello! Thank you for taking the time to post this. I had discovered the intitial post — but was getting the Input/Output error. After a few more searches – and dead end paths, I found your post.

    Ideally I would have liked to get this working in Ubuntu 11.10 Nautilus “Home Folder > File > Connect to Server” then use secure webdav. Then be able to save username and password to the login keyring in a secure fashion. Unfortunately, connecting this way seems broken as I would only receive “302 Moved permanently” errors.

    So, I’m grateful to have your method!

  5. getting this error

    sudo mount /mnt/box.net mount: can’t find /mnt/box.net in /etc/fstab or /etc/mtab

  6. UID and GID need to replaced with the user id and group id of the user who can have read write access to the mounted folder…

    Otherwise only rood will have write acesss

  7. Why is it that in order to open a directory, it has to read over the network the equivalent of the total amount of data in that directory? For example, just to LIST the files in my /mnt/box.com/Backups directory, which has over 2 GB of data, I get 2 GB of throughput? Why does this happen, and is there a fix?

Leave a Reply

Your email address will not be published. Required fields are marked *

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=""> <strike> <strong>