Sagar Behere

I doubt, therefore I might be

Access box.com using GNU/Linux via webdav

Scandinavia's largest technical university, KTH, recently offered its employees access to a Dropbox-like service at Box.com. However, box.com does not have a sync client for GNU/Linux, which leaves linux users in the lurch.

Even though box.com does not officially support webdav, it is possible to mount your storage via webdav with a little tinkering. Here is a concise guide (below steps partially based on the owncloud webdav guide at http://owncloud.org/support/webdav/):

First of all, log in to kth.box.com, go to account settings and create a password for external, non-SSO applications. Then

  1. Install davfs2. For a debian or derived distribution, this is as simple as sudo aptitude install davfs2
  2. Reconfigure davfs2 to allow access to normal users: sudo dpkg-reconfigure davfs2 (select Yes when prompted)
  3. Add the users you want to be able to mount the share to the davfs2 group: sudo usermod -aG davfs2 <user>
  4. Edit /etc/fstab, and add the following line for each user who wants to mount the folder (with your details where appropriate): https://www.box.com/dav /home/username/kth.box.com davfs rw,user,noauto 0 0
  5. For each user: mkdir ~/kth.box.com;mkdir -p ~/.davfs2;echo "https://www.box.com/dav username@kth.se password" >> ~/.davfs2/secrets;chmod 600 ~/.davfs2/secrets Tip: read the davfs2.conf man page if your password contains special characters.

Update: df -h will report incorrect usage statistics. This is probably because box.com does not support RFC 4331. From the davfs2 README:

If the server does not support RFC 4331 (most servers don't), davfs2 cannot calculate the free disk space on the server. But some applications (e.g. nautilus) insist on this. So davfs can't help but lie. I tried to make the numbers look funny, so you will notice they are faked.

The user can now mount the box.com storage with mount ~/kth.box.se and use tools like rsync, unison etc. to sync specific folders. If you experience trouble when you create a file in the directory, add use_locks 0 to your davfs2.conf file.