07 January 2012

Protip: Mounting BOX Cloud Storage Accounts

One of the most difficult things about using cloud storage for me was the ability to use the storage shares within Windows 7 or Ubuntu Linux without having to use a browser, especially with services like Box. Recently Box offered 50GBs to new users, and I decided to add Box to my cloud storage repertoire, but the lack of the integration of free disk syncing made adoption of the service difficult for me - until I uncovered that you can using the Box service as a WebDAV endpoint.

Linux (Command-line)

Most recent versions of Linux have the ability to mount arbitrary filesystems as subfolders within your filesystem using FUSE. We can leverage the power of FUSE with a FUSE mounter for WebDAV to allow our Linux system to mount Box as folder on our system and interact with the files in our Box account much like that of a normal file.
In a Debian-distro (e.g. Ubuntu), you will first need to ensure you have the davfs2 package installed.
$ sudo apt-get install davfs2
Now, create a folder that will be used for Box mounting:
$ mkdir ~/box.com
Make a backup of your /etc/fstab file:
$ sudo cp /etc/fstab /etc/fstab.bak
Now, add a new entry to your /etc/fstab. BEFORE PRESSING ENTER, MAKE SURE YOU ENTER THE COMMAND BELOW EXACTLY AS IT APPEARS. If you mess up, restore your backup made in the previous step before doing anything else:
$ sudo sh -c "echo https://www.box.com/dav $HOME/box.com davfs rw,user,noauto 0 0 >> /etc/fstab"
Now, reconfigure the davfs2 package to allow users to mount (select Yes in the prompt):
$ sudo dpkg-reconfigure davfs2
Then add your username to the davfs2 group:
$ sudo adduser $USER davfs2
Now, let's configure the mount point:
$ mkdir ~/.davfs2
$ cp /etc/davfs2/davfs2.conf ~/.davfs2
Modify the configuration file and make the following changes:
$ nano ~/.davfs2/davfs2.conf
  1. Comment out the line "ignore_home"
  2. Uncomment the line "use_locks" and replace it with:
    use_locks 0
Optional: You can permanently store your credentials so you are not asked every time you try to mount Box:
$ cp /etc/davfs2/secrets ~/.davfs2
$ echo https://www.box.com/dav [username@email.com] [password] >> ~/.davfs2/secrets
Now you should be able to mount your account to the box.com folder and browse it:
$ mount ~/box.com
You could also add a script to your desktop to do the mount for you:
$ nano ~/Desktop/MountBox.sh
#!/bin/sh
# Mount Box to ~/box.com
mount ~/box.com
You can also unmount it:
$ umount ~/box.com
(source: http://ubuntuforums.org/showpost.php?p=11258734&postcount=34)

Linux (Nautilus GUI)

If you don't need command-line level access to your Box account, you can also mount the WebDAV directory by using Nautilus (if you are using Ubuntu, for example).
While you Desktop is in focus, click File > Connect to Server in the menu bar. Type www.box.com and choose "Secure WebDAV (HTTPS)" in the Type dropdown. Enter "/dav/" in the folder and provide your credentials (hint: email as username).

Windows

Windows 7 also supports mounting WebDAV but as a special folder in Computer. Open "Computer", right-click and select "Add Network Location." In the address field, type "https://www.box.com/dav/" and finish.

MacOS X

Like using Nautilus on Linux, MacOS X has the capability to use WebDAV in a GUI. Though I do not use MacOS X personally, from what I have gathered from the web, you can use Finder, then go to Go > Connect to Server to connect to "https://www.box.com/dav/". You will be prompted for your Box username and password.
(source: http://www.webdavsystem.com/server/access/macosx)

Conclusion

New cloud storage services are great ways to eliminate the need to carry around USB drives and other media. They promise the convenience of being able to store and access files regardless of location, with the added assurance of ensuring the data is secure and continuously backed up. Unfortunately, these storage services many times do not support access to your files in traditional ways, often requiring the use of a browser. Mercifully, those at Box understood the difficulty some may have with accessing their files on their service and gave users the ability to use more traditional means to access their files, especially when a browser is unavailable (such as on headless servers). Hopefully the information I've shared with you will help you gain the most out of the use of the Box service.

No comments: