Access Your Box.com Account from Your Linode
Updated by Tyler Nelson Written by Tyler Nelson
If you’ve discovered Box then you know that it can be a great tool for storage, moving and managing files. The following tutorial helps you install and configure a free piece of software that facilitates Box access from your Linode.
Before You Begin
Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.
This guide will use
sudowherever possible. Complete the sections of our Securing Your Server to create a standard user account, harden SSH access and remove unnecessary network services.
Update your operating system.
NoteThis guide requires having a Box account.
Set Box’s Mount Point
The following step will create an empty directory where Box will live and all of your Box files and folders will appear. You can mount it anywhere, but
/home/example_user/box will be used for this guide.
Create a mount point:
NoteIf only your
example_userneeds access to the Box account contents, making the mount point in that user’s
/homedirectory will be fine. If multiple system users (other than root) need access to the Box account, then the mount point should be placed in a system directory such as
/mnt/box. For more info, see the davfs man page.
Add Box to fstab.
The fstab (or file systems table) file is a system configuration file commonly found at
/etc/fstab. It contains the necessary information to automate the process of mounting. Add an entry for your Box account:
https://dav.box.com/dav /home/example_user/box davfs rw,user,noauto 0 0
Configure WebDAV and User Permissions
Install davfs2, the WebDAV backend which is used to communicate between your Linode and Box account:
sudo yum install davfs2
Debian / Ubuntu
sudo apt-get install davfs2
When asked if unprivileged users should be allowed to mount WebDAV resources, choose
sudo dnf install davfs2
Give your user permission to mount using davfs2. Replace
example_userwith your user name.
sudo usermod -aG davfs2 "example_user"
Reboot your distro. This is the best way to be sure there are no user sessions lingering open. If there are, you’ll experience problems mounting the Box drive even after adding your user to the proper group.
SSH back into your Linode.
The WebDAV share exported by Box.com does not support file locks. Thus, you need to disable file locks in the davfs2 configuration file. Otherwise, you will encounter “Input/output error” while attempting to create a file.
echo 'use_locks 0' >> ~/.davfs2/davfs2.conf
Add your Box account info to WebDAV’s secrets file, replacing both
passwordwith your Box password.
echo 'https://dav.box.com/dav email password' >> ~/.davfs2/secrets
NoteIf your password contains quotation characters (
"), you’ll need to edit the secrets file directly in a text editor.
secretsfile readable to only its owner:
chmod 600 ~/.davfs2/secrets
Mounting and Unmounting Your Box Drive
To mount and change into its directory:
To confirm that your Box drive is mounted:
The output should look similar to this:
Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 4122048 886316 3009636 23% / devtmpfs 505636 0 505636 0% /dev tmpfs 507504 0 507504 0% /dev/shm tmpfs 507504 1420 506084 1% /run tmpfs 507504 0 507504 0% /sys/fs/cgroup tmpfs 507504 0 507504 0% /tmp tmpfs 101504 0 101504 0% /run/user/1000 https://dav.box.com/dav 10485756 72 10485684 1% /home/example_user/box
To see the mount options with which your Box drive is mounted:
cat /proc/mounts | grep box
The output should show the following:
https://dav.box.com/dav /home/example_user/box fuse rw,nosuid,nodev,noexec,relatime,user_id=1000,group_id=1000,allow_other,max_read=16384 0 0
You’re done! The directory
~/box will now reflect your Box contents! The first time you access the folder it may take a few minutes for the contents to synchronize. After that, folder access is almost immediate.
Join our Community
This guide is published under a CC BY-ND 4.0 license.