BOX.net for Linux (or how to sync from/to WebDAV in general)

BOX.net offers users to sync their files from local disc to the BOX-cloud.
Box offers clients to Windows and Mac, but not to Linux :-(

Instead of using BOX you could use Dropbox, but it will not encrypt your files.
On the upside they offer clients to Windows, Mac AND Linux (as well as Android).
Another solution is to use Owncloud and use their client for sync with Windows, Mac, Linux and Android.

Since I like using Linux at home and I got 50GB of storage at BOX.net (due to I have a Samsung Android phone),
I searched for a solution to sync my files to Linux (as well as my other computers and phones).

This is a solution that works for me, running opensuse 12.1

Part1 Mount box and create a mirror of the directory on the server

1) Install davfs2   (Link: devfs2)

2) Create a mount point for a mirror to box via davfs2:

mkdir ~/box

 3) Create a local mirror that you can do the work in.

mkdir ~/boxmirror

 4) Make it possible to mount in users homedir

make sure the user belong to the group devfs2

 5) copy davfs configuration file and activate lock

mkdir ~/.davfs2

cp /etc/davfs2/davfs2.conf ~/.davfs2

echo "use_locks    0" >> ~/.davfs2/davfs2.conf

 6) Save logon info to box in a file that only the user can read (stored in plain text)

vi .davfs2/secrets

Edit the file and make sure it contains:

https://www.box.com/dav     Box_username    "Box_password"

7) Change access rights to the file and make it private to the user

chmod 600 ~/.davfs2/secrets

 8) Open davfs2.conf and search for this line

# secrets         ~/.davfs2/secrets # user config file only

delete “#”:

 9) Search for this line and make sure the #-tag is deleted

ignore_home       kernoops,distccd  # system wide config file only 

10) Auto mount the box connection on startup, by editing

/etc/fstab

add this line:

https://www.box.com/dav /home/ditt-användarnamn/box         davfs rw,user,noauto 0 0

 11) mount box

mount ~/box

 12) if an acces right accur change access right like this (as root)

chmod u+s /sbin/mount.davfs

 13) Make a first mirror

/usr/bin/rsync -rtvcs --progress /home/user/box/ /home/user/boxmirror/

 
Link to part2: