Follow this process for using box with Linux. Access Box with the command line or mount Box on Linux.
This assumes that you already have a Box account.
Using Box with Linux
These are 2 ways of using Box with Linux:
- Access Box through the command line
- Mount Box on Linux
Access Box through the command line
First let start by understanding WebDAV. As seen on the offical docs here
WebDAV stands for Web-based distributed authoring and versioning. Which is a set of extensions for HTTP that allows you to collaborate with other users to edit and manage files on remote servers.
Box and WebDAV
Here is more info from Box about supporting WebDAV.
It says that to connect to Box using WebDAV you must follow these rules:
- Server: https://dav.box.com/dav
- Login: Use your Box login and password
- Web browser is not supported. You have to use a WebDAV client.
It also says that it has some issues. Although keep in mind this was posted in 2014. I am not sure if these issues remain as of now.
- Uploads create 2 file versions. The first as a placeholder with zero byte size and the 2nd when the file completes uploading
- When opening a MS Office file (word, excel, powerpoint) it might be a pain and ask for login every time you open a file. Recommendation is to keep those programs open when accessing these types
Box on Linux using Cadaver for the command line
Cadaver is a command line client for WebDAV. Here is more info about it.
If you have Ubuntu this is easy:
sudo apt install cadaver
Otherwise follow instructions on the documentation to install this WebDAV client above.
Use it like this:
Then enter your user and password.
You can type
help to get more info.
Mount Box on Linux
If you get tired of using the command line. You can mount Box on Linux.
You need to install a package called
sudo apt install davfs2
When installing this will open a window that says “Configuring davfs2” to allow mount.davfs2 to be mounted by a non-root user.
You have to answer “Yes”.
You are almost done 🙂
Once that’s done installing.
Create a directory in your home directory where you want to mount Box.
For example. In your home directory you could have this directory:
Setting up the WebDAV client
Now you have to edit this file:
$ sudo vim /etc/fstab
You could add this:
# Box WebDAV client
https://dav.box.com/dav /home/your-user/the_matrix davfs user,rw,noauto 0 0
You can read more about what this means in the man page of fstab:
Obviously you just don’t want to copy/paste without understanding what this means so…
It says that
fstab contains information about the filesystems that the system can mount.
The 1st field
https://dav.box.com/dav is the remote filesystem to be mounted.
The 2nd field
/home/your-user/the_matrix is the target mount point.
The 3rd field
davfs is the type of filesystem
Then you have all that weird stuff
user,rw,noauto 0 0
userallows a user to mount
rwis the type of mount. Read/write
noautodo not mount at boot time
Please do a little research to see what
0 0 means. I will update the post and link to your website or profile right here with the answer.
Adding your-user to the davfs2 group
Use the following:
$sudo gpasswd -a your-user davfs2
Setting up davfs2 configuration
You don’t have to do this but if you are really lazy. It can help you setup your account when you use the
$ cp -r /etc/davfs2/ ~/.davfs2/
It might say that you don’t have access to the
secrets directory. Disregard this message for now.
You will see that your home now has a directory called
.davfs2 with these contents:
- cache (dir)
- certs (dir)
- davfs2.conf (file)
- secrets (file)
Open the configuration file. If you are in your home dir:
$ vim .davfs2/davfs2.conf
Uncomment this line:
# secrets ~/.davfs2/secrets
Save and close.
Setup your account in the secrets file
In this file
Following the example above as the target mount point:
$ vim .davfs2/secrets
Add this line to the end of the file:
Save and close.
What this will do is that when you try to mount the target. You will only have to enter your password. But you can also disregard this edit if you prefer to type in your user and pwd when prompted after using
If you really want to use the
secrets file. Please do an additional step:
$ chmod 600 ~/.davfs2/secrets
Here is where I spent a little bit of time. Before mounting the directory it would tell me that I didn’t belong to the group
Even though I followed that step
$sudo gpasswd -a your-user davfs2
If I typed
groups tom. It showed I had that group. But when I typed just
groups it didn’t show the group
Some troubleshooting suggested that I should do these but this didn’t work:
- Restart the terminal
- Logout of the computer and login
- Change permissions to some files (I preferred not doing that. It seemed like a hack)
Instead what worked was simply restarting the computer.
Mounting Box to Linux
If you are in the home directory.
$ mount the_matrix
Thanks for these sources for clarifying a few things: