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:

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.

15 Comments

  • Pingback: Easy Autoconfiguration for Ubuntu - Page 23 - webOS Nation Forums

  • Aivars
    February 24, 2012 - 11:42 am | Permalink

    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

    • March 1, 2012 - 11:57 am | Permalink

      @Aivers I’ve never used the “_netdev” option, but what happens if your network disconnects? Does fstab automatically unmount? I have a feeling it doesn’t.

  • Pingback: Accede a tu cuenta de Box.net de 50 GB desde Ubuntu | El atareao

  • Jørgen Thulstrup
    February 28, 2012 - 5:10 am | Permalink

    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?

  • Jørgen Thulstrup
    February 28, 2012 - 5:29 am | Permalink

    Another bump … I can mount (manually) but I only have read permissions :-(
    What’s the point :-(

  • U. Buntu
    February 28, 2012 - 9:13 am | Permalink

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

  • Pingback: Box.net offering 50GB free for lifetime « Old Papyrus

  • Rodo
    March 3, 2012 - 11:48 pm | Permalink

    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!

  • Brian Thompson
    March 6, 2012 - 6:29 am | Permalink

    getting this error

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

  • boxer
    March 8, 2012 - 9:09 am | Permalink

    hi guys

    you need to replace the box.net by box.com and it will work again

    HTH

  • Tapasvi Moturu
    March 21, 2012 - 8:26 pm | Permalink

    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

  • Pingback: Accede a tu cuenta de Boxnet de 50 GB desde Ubu

  • daster
    March 27, 2012 - 6:48 pm | Permalink

    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?

  • box
    April 24, 2012 - 2:50 pm | Permalink

    @daster
    If you remove “async” from the mount params, it should solve your problem.

  • 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>