How to mount Box.com cloud storage on Linux

Last updated on February 7, 2021 by Dan Nanni

Box.com is an online cloud storage provider targeting both individual users and enterprise customers. For individual users it offers 10GB free storage space. Box.com users can access its cloud storage via web interface or multi-platform mobile client software. As of yet, however, Box.com does not offer a native Linux client for their platform. Thankfully, they provide a secure WebDAV interface, through which your Box.com account can be exported as a WebDAV share over HTTPS. This means that you can easily mount your Box.com account and access it on Linux via its WebDAV interface.

Here are two different ways to mount Box.com account on Linux via its WebDAV interface.

Mount Box.com Storage Account with Nautilus File Manager

You can mount and access your Box.com storage account via Nautilus, also known as GNOME Files, which is the default file manager of GNOME desktop. Nautilus file manager has a built-in support for accessing remote files over multiple protocols (e.g., FTP, NFS, Samba, SSH, AppleTalk, WebDAV). Thus, you can simply use its WebDAV connection interface. There is no need to install any extra software to mount Box.com.

To mount Box.com on Nautilus file browser, click on "Other Locations" on the left sidebar. Find the "Connect to Server" field at the bottom and fill in the server address in the following format.

Once you click on Connect button, you will be prompted to enter the username and password for your Box.com account.

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. Here is a step-by-step procedure for setting up Box.com mount with davfs2.

Step One: Install davfs2 on Linux

For Ubuntu, Debian or Linux Mint:

$ sudo apt install davfs2

For CentOS/RHEL or Fedora:

$ sudo yum install davfs2

Step Two: Configure davfs2

Once davfs2 is installed, go ahead and configure davfs2 as follows.

First, 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

Step Three: Enable Non-Root Mount

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.

For Ubuntu, Debian 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 $USER

For CentOS, RHEL or Fedora:

Simply run the following command.

$ sudo usermod -a -G davfs2 $USER

Step Four: Edit /etc/fstab

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

Step Five: Mount Box.com

Finally, 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: [email protected]
Please enter the password to authenticate user [email protected] 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 [email protected] my_box_com_password

Step Six: Verify Box.com Mount

To verify that mount was successful, you can use these commands:

$ 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

If you want to unmount Box.com account, simply run:

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

Summary

In this tutorial, I demonstrate how to mount your Box.com cloud storage account on Linux using its WebDAV interface. Note that Box.com officially has ended WebDAV support since October 2019, meaning they do not provide any technical support regarding WebDAV. As of this writing (February 2021), their WebDAV interface still works fine. Even you can mount Box.com via two-factor-authentication, where you use a verification code you receive on your phone as a one-time password. If you encounter technical issues or any change in their interface, feel free to let me know in the comments.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean