How to mount Box.com cloud storage on Linux

Box.com (previously Box.net) is an online cloud storage provider targeting both individual users and enterprise customers. Box.com users can access its cloud storage via web interface or multi-platform mobile client software.

As of writing, Box.com does not offer a native Linux client. Thankfully, however, they make available WebDAV servers which export your Box.com account as a WebDAV share, so you can mount your Box.com account and access it via WebDAV over HTTP/HTTPS. Here are two different ways to mount Box.com account on Linux via WebDAV.

Mount Box.com storage account by Nautilus

You can mount and access your Box.com storage account via Nautilus -- file manager for the GNOME desktop. Open up Nautilus, and click on "Connect to Server" under "File" on its menu.

Then type in the following server and user details.

After you are successfully connected to a Box.com's WebDAV server, your Box.com account will be accessible on Nautilus as follows.

If you want to have Box.com account mounted automatically on Nautilus, you can use the "bookmark" feature of Nautilus. That is, right-click on the Box.com mount on Nautilus, and select "Add Bookmark" menu.

After bookmarking, you will see the saved bookmark on the left top corner of Nautilus. In order to re-mount your Box.com account later, simply click on this bookmark.

Mount Box.com storage account via davfs2

The second method is to use davfs2 (WebDAV Linux File System) which enables you to access a remote WebDAV share via traditional file system interfaces.

To install davfs2 on Ubuntu, Debian or Mint:

$ sudo apt-get install davfs2

To install davfs2 on CentOS, RHEL or Fedora:

$ sudo yum install davfs2

Next, create a local mount point.

$ mkdir ~/box.com

The WebDAV share exported by Box.com does not support file locks. Thus you need to disable file locks in the davfs2 configuration file located at /etc/davfs2/davfs2.conf. Otherwise, you will encounter "Input/output error" while attempting to create a file.

$ sudo vi /etc/davfs2/davfs2.conf
use_locks      	0

In addition, if you want to be able to mount Box.com's WebDAV share as a non-root regular user, follow the distro-specific procedure below.

Mount Box.com as a non-root user on Debian, Ubuntu or Mint

Reconfigure davfs2 by using dpkg-reconfigure as follows.

$ sudo dpkg-reconfigure davfs2

At the dpkg-reconfigure screen (as shown below), click on "Yes" button.

After this, add yourself to a Linux group called "davfs2".

$ sudo usermod -a -G davfs2 xmodulo

Mount Box.com as a non-root user on CentOS, RHEL or Fedora

Simply run the following command.

$ sudo usermod -a -G davfs2 xmodulo

Once you have followed the above distro-specific instruction, add the following to /etc/fstab. The "user" option allows you to mount Box.com as an unprivileged non-root user. Replace "/home/xmodulo/box.com" with your own mount point.

https://dav.box.com/dav /home/xmodulo/box.com davfs rw,user,noauto 0 0

Now you can go ahead and mount your Box.com account by running mount command as a regular user. When asked for username and password, enter your Box.com account username/password.

$ mount box.com
Please enter the username to authenticate with server
https://dav.box.com/dav or hit enter for none.
  Username: my_email@address.com
Please enter the password to authenticate user my_email@address.com with server
https://dav.box.com/dav or hit enter for none.
  Password:  

If you do not want to type in username/password every time you mount, put your Box.com login credential information in the following file.

$ chmod 600 ~/.davfs2/secrets
$ vi ~/.davfs2/secrets
https://dav.box.com/dav my_email@address.com my_box_com_password

To verify that mount was successful, run these:

$ mount
https://dav.box.com/dav on /home/xmodulo/box.com type davfs (rw,nosuid,noexec,nodev,_netdev,user=xmodulo)
$ df
Filesystem              1K-blocks      Used Available Use% Mounted on
/dev/mapper/ubuntu-root 953024420 131576980 773036612  15% /
udev                      4008844         4   4008840   1% /dev
tmpfs                     1607344       908   1606436   1% /run
none                         5120         0      5120   0% /run/lock
none                      4018352      1408   4016944   1% /run/shm
none                       102400        28    102372   1% /run/user
/dev/sda1                  233191     53518    167232  25% /boot
https://dav.box.com/dav  26666664  13333332  13333332  50% /home/xmodulo/box.com
$ ls ~/box.com
Documents lost+found Photos Videos

To umount Box.com account:

$ umount box.com
/sbin/umount.davfs: waiting while mount.davfs (pid 6824) synchronizes the cache .. OK

If you find this article useful, share this article on your social network.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.
Your name can also be listed here. Write for us as a freelancer.

38 thoughts on “How to mount Box.com cloud storage on Linux

  1. Hi,

    I've followed these instructions and everything is working fine. Anyway I've your same problem when I execute df:

    https://www.box.com/dav 26666664 13333332 13333332 50% /home/andrea/box.com

    I really do NOT have 50% space taken :)
    If I go on my Box.com dashboard I still have all 25Gb available.

    How can I fix that?

    • It is because df is getting fake space info from davfs2.

      In order for davfs2 to report available space correctly, WebDAV server must export "used bytes" and "available bytes" properties (e.g., see RFC4331). Box.com WebDAV server probably does not implement that feature.

      From davfs2 README:
      "If the server does not support RFC 4331 (most servers don't), davfs2 cannot calculate the free disk space on the server. But some applications (e.g. nautilus) insist on this. So davfs can't help but lie. I tried to make the numbers look funny, so you will notice they are faked."

  2. Hi,

    So I have followed your instructions. However I cannot open any files or copy any file from the mounted folder. Either get a no such file or directory or permission denied error.

    How can I gain full access?

    Might be on boxes end?

    Rob

    • You might not be connected to Box.com's WebDAV server properly. Can you at least browse the mounted folder? Also please check if the following command give you something like the following.

      $ sudo netstat -nap | grep davfs

      tcp        0      0 192.168.1.3:52776       74.112.184.198:443      ESTABLISHED 2861/mount.davfs
      
  3. I used your 1st method to access my box account, and it worked fine untill I rebooted. then it was gone. Do I need to remount it everytime I reboot?

    • What you can do is to "bookmark" the Box.com mount on Nautilus, so that you can re-mount Box.com easily via the bookmark. Please refer to the updated post above for more detail.

  4. at first glance it works like a charm. I manged to write a file inside. I'll test how sync works as I have a copy of all the files locally. Well, at worst I'll do a rsync -- delete on the two directories.

  5. Contents of new upstart style init file for ubuntu 13.04 that will automount the above config if password and username saved in ~/.davfs2/secrets

    cat /etc/init/box.conf
    ---------------------Contents Below---------------------------
    start on runlevel [2345]
    stop on shutdown
    respawn

    exec sudo -H -n -u xmodulo /bin/mount /home/xmodulo/box.com

  6. FYI, in gnome-3 the "connect to server" screen changed a lot. use "davs://www.box.com/dav", you will be prompted for credentials, and how long to cache them.

    • If you are trying to mount box.com for the first time, ~/.davfs2 may not exist yet. So first try mounting box.com without setting username/password. Once ~/.davfs2/secrets is generated, then go ahead and modify ~/.davfs2/secrets.

  7. Ubuntu 12.04 64-bit
    I had followed these directions several months ago, and was able to get this to work flawlessly. Now in trying to look at something on my box.com mount, I find it will not mount. When I try to mount ( mount box.com), after entering creds, I get:
    /sbin/mount.davfs: Mounting failed.
    404 not found.

    I have re-traced the steps, and found 2 things that appear to be different, but I am reluctant to change (as I'm not sure where they came from):
    1. I have a ~/.davfs2/davfs2.conf file (e.g., user-level). I don't see that referenced here, and it had a system-wide setting (user_locks) that I had to comment out due to a different error (system-wide setting in user config file)
    2. in the /etc/davfs2/davfs2.conf (e.g., system-wide), I see that the setting for user_locks has been placed in a 'section' apparently specific to box.com - I may have done this but I don't see it in the instructions here, and I doubt I was enterprising enough to look specifically for how to limit this to a specific mount point. The section is:
    [~/box.com]
    use_locks 0 # from http://xmodulo.com/2013/02/how-to-mount-box-com-cloud-storage-on-linux.html

    So I'm not sure why/where it is failing, or what changed to make it not work - it's been a few months since I've tried to access anything through it (though I did verify that my account creds w/box.com are the same).

    Thanks in advance!

  8. Thanks for the instructions. Working perfectly on Ubuntu 13.10. FWIW it seems like they are now reporting usage properly:

    graeme@graeme-laptop:~$ df -h box.com
    Filesystem Size Used Avail Use% Mounted on
    https://dav.box.com/dav 50G 17M 50G 1% /home/graeme/box.com

  9. I am glad I found this post. Indeed the new point is important: https://dav.box.com/dav instead of the previous https://www.box.com/dav which lead to the 404 Not found error.
    My question is how can I connect more than one box.com accounts in the same computer?
    I would like to provide the box.com account for every user. How to have multiple entries in /etc/fstab and /etc/davfs2/secrets to perform this action?
    Great thread :)
    Thank you.

  10. I think you can simply repeat the process for every user on the host.

    Allow them to mount:

    $ sudo usermod -a -G davfs2 user1
    $ sudo usermod -a -G davfs2 user2

    Edit /etc/fstab:

    https://dav.box.com/dav /home/user1/box.com davfs rw,user,noauto 0 0
    https://dav.box.com/dav /home/user1/box.com davfs rw,user,noauto 0 0
    

    Then have each user store their Box password in his/her own home directory:

    $ vi ~/.davfs2/secrets

    • Any idea how to connect multiple box.com accounts to the *same* Ubuntu user?

      For each of my box.com accts I've added a "https://dav.box.com/dav my_email@address.com my_box_com_password" line to ~/.davfs2/secrets and a "https://dav.box.com/dav davfs rw,user,noauto 0 0" line to fstab.

      I don't know a way to tell davfs2 which mounted folder from fstab corresponds to which line in secrets, though. For every mounted folder, davfs2 just mounts it to the box acct whose login info is the last (furthest down) entry on the secrets list.

      Thanks in advance for any ideas you might have

      • I can't take credit for this answer. Credit goes to Arch Linux.

        I found the information here: https://wiki.archlinux.org/index.php/Davfs

        If you want to mount several disks from same server, you need specify mount points of this disks instead of server address in file ~/.davfs2/secrets

        /home/username/disk1 webdavuser1 webdavpassword1
        /home/username/disk2 webdavuser1 webdavpassword2
        .........
        /home/username/diskN webdavuserN webdavpasswordN

  11. Thanks for posting this. I managed to connect my box account in KDE over kubuntu 12.04 without any issue. I followed your first solution and configured my box account in dolphin file manager without any issues!

  12. Excellent description that worked seamlessly, first time.
    I notice that you can mount subdirectories of your Box.com account by adding their path to the mount source path, e.g. https://dav.box.com/dav/pictures. This allows you to mount different folders on you Box.com account, maybe to allow different users to access different folders or to limit access to the files stored on Box.com.

    I also noticed that copying large amounts of data appears to complete (much) sooner than it actually does, e.g.
    cp ~/pictures/* ~/box.com/pictures
    returned to a command line prompt in a few minutes but the 12GB of files are continuing to be copied (sync'd) in the background. Useful but something to be aware of. I don't know what happens if the local host is turned off part way through. Does it wait for the sync to complete whilst unmounting the path (which would be in about two days for me), hence delaying power-off? Does it stop copying (syncing)? Does it leave truncated (partially copied) files? Who knows - I don't want to try it on this sync!

  13. Thanks for the guide, it made setting up the command-line version a breeze.

    While it mounts like a charm and I can happily open/read files I have an odd issue with a keepass DB file.

    If I edit it, and save it it disappears after a while, and ends up in my "Trash" in the web-interface. I can reproduce the behaviour, but can't stop it from happening, which kind of makes it pointless :(

    Download via web-interface followed by uploading a new version works as expected - but that's so tedious. Mind you, so is losing the file, and the work that went into it. :)

    Has anyone experienced similar issues, or, even better, found a way to get around the issue?

  14. I went through these directions and made the changes to my server. Unfortunately, now when I restart the server I am prompted to enter my box username on the server terminal at startup but it won't let me enter anything. And pressing enter does nothing. So I am stuck and can't get to where I can edit my fstab file to remove that line. What can I do?

  15. At last! Thanks; after months of searching, your instr's have Nautilus connecting to Box. However it's quite slow just to display folder contents of my Box account. Is there anything I can do at Linux Mint/Nautilus end to speed downloads up?

    Thanks again.
    Chris A.

Leave a comment

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