Blog is moving

My blog is moving to http://victormendonca.com/blog/. If you are looking for a specific or older post you are in the right place Otherwise check out my new page for more up to date content.

Thursday, December 13, 2012

How to mount Box.com storage via davfs2

A while ago Box.com had a promotion and they were giving out a free 25GB account, so I hurried to get one. If you were like me, or if you just have some storage with them and are looking for a way to mount it in Ubuntu, here's the solution.

We will be mounting your box.com storage with WebDav, so we will need to install a package for that:

$ sudo apt-get install davfs2


After the package is installed we will need to reconfigure it so normal users can mount it. When prompted if unprivileged users can be allowed to mount WebDav resources, say "Yes":

$ sudo dpkg-reconfigure davfs2


We also need to give it the proper permission and add your user to the proper group:

$ sudo chmod u+s /sbin/mount.davfs

$ sudo addgroup [user] davfs2


Now create a location where you would like to mount your storage. I chose the following:

$ mkdir $HOME/Export/Box


Now we need to create two configuration files for davfs2, one for file locking, and another with your credentials. The files should be in the following format:

$ mkdir $HOME/.davfs2

$ cd .davfs2

$ cat davfs2.conf 
use_locks 0

$ cat secrets 
https://www.box.com/dav [email] [password]

$ chmod 600 secrets


Almost done. We now will add an entry in fstab (sudo vim /etc/fstab) to mount box.com automatically:

# Mounts Box.com
https://www.box.com/dav /home/[user]/Export/Box davfs _netdev,rw,user 0 0


And that's it. As long as you have a network connection box.com will be mounted automatically (that's the _netdev option). And if it doesn't, you can run the command below to mount it:

$ mount $HOME/Export/Box





No comments: