Blog is moving

My blog is moving to 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 storage via davfs2

A while ago 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 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 [email] [password]

$ chmod 600 secrets

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

# Mounts /home/[user]/Export/Box davfs _netdev,rw,user 0 0

And that's it. As long as you have a network connection 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: