Using Box.com cloud storage on Linux

2015-08-07

Recently CMU announced all users will have 1TB of space of cloud storage at Box.com. This motivated me to set it up on my Linux box. I have not tired to get syncing working, since I’m perfectly happy with my unison set up. But I can now mount it as a local folder and copy files back and forth.

Using davfs2 to mount your Box.com storage.

  1. Install davfs2 (on Ubuntu/Debian type aptitude install davfs2 as root).

  2. Allow mount.davfs2 to be installed with SUID bit set. The installation prompts for it on Debian. If you made the wrong choice use dpkg-reconfigure davfs2 (as root).

  3. Edit /etc/fstab and add the line

    # BOX WebDAV
    https://dav.box.com/dav /home/gautam/net/box davfs user,rw,noauto 0 0
    

    Replace gautam with your username and net/box with the path in your home folder.

  4. Add yourself to the davfs2 group (type gpasswd -a gautam davfs2 as root, log out and log back in.)

  5. If you use a single sign on to access your share, then you need to create an external password. Login to Box.com, go to Account settings / Account and create an external password.

  6. Edit ~/.davfs2/secrets and add the line

    /home/gautam/net/box <email> <password>
    

    CMU users, use your xxx@andrew.cmu.edu email and your external password from above. Regular Box.com users, use the email address you use to sign on to your account. You can also omit the password and the client will prompt you every time you want to mount it.

  7. mount ~/net/box (as a normal user), and you should have your Box.com files in this folder.

  8. When you’re done (esp. before you go offline) be sure to umount ~/net/box, since your changes might only be cached on your local machine and not synced to the server.

Limitations

  1. As of 2015-08-07 davfs2 doesn’t support symbolic links.

  2. Uploading some 2GB of data (many small files) took a really long time on a very fast connection.

  3. Can’t seem to update sharing and permissions from the file-system, and have to use the website.

Syncing to Box.com

There is an experimental open-source (third party) sync client here. There is also a Python API provided. But I haven’t tried either.

Using Box.com on Mobile devices.

They seem to have apps for most platforms here.

🗫 Comments

  • Anonymous
    WebDAV clients on Android

    Anonymous (2015-09-17 11:18:09 EDT)

    All WebDAV clients on Android can access your Box.com account too.

  • MRE
    mount cant find

    MRE (2016-07-14 07:49:34 EDT)

    on step 3: nano /etc/fstab add the line as written, save and exit at step 7, I get back “mount: can’t find username/net/box in /etc/fstab or /etc/mtab I have tried a number of different versions of the same guide, and always get trapped at the same place.

  • Gautam Iyer
    Re: mount cant find

    Gautam Iyer (2016-07-14 21:10:21 EDT)

    Your home directory might be in a different location. Do echo ~/net/box and see if prints the same thing you put in fstab (/home/gautam/net/box in the above example).

  • timmay
    User must be member of group davfsz

    timmay (2016-10-07 12:19:13 EDT)

    I went over the same steps but on doing the mount. This is the error I got. /sbin/mount.davfs: user “username” must be member of group davfs2

  • jttheninja
    ~/.davfs2/secrets has wrong permissions?

    jttheninja (2017-04-12 09:00:07 EDT)

    I’ve followed this to the letter, but each time I try to mount ~/net/box, I get the message /sbin/mount.davfs: file /home/xyzabc/.davfs2/secrets has wrong permissions. Did something change with the recent update to 2FA with Duo?

  • Gautam Iyer
    Re: ~/.davfs2/secrets has wrong permissions?

    Gautam Iyer (2017-04-12 09:41:05 EDT)

    I’ve followed this to the letter, but each time I try to mount ~/net/box, I get the message /sbin/mount.davfs: file /home/xyzabc/.davfs2/secrets has wrong permissions. Did something change with the recent update to 2FA with Duo?

    Strange. I enabled 2FA a while ago, and this works for me no trouble. Doubt it is 2FA related.

    My ~/.davfs2/secrets has permissions 0700 if it helps. It might be because adding yourself to the group davfs2 hasn’t taken effect yet. After adding yourself to the group, you have to log out and log back in for it to take effect. Try typing groups username and see if davfs2 shows up.

  • Ron
    Misc tips

    Ron (2017-07-03 17:08:34 EDT)

    Your writeup work great for me. I needed to use a box external password since my company uses single-sign-on for box, so this was needed.

    If you’re told ~/.davfs2/secrets has the wrong permissions, do this: chmod 400 ~/.davfs2/secrets.

  • Don
    Mount command fails with "500 Internal Server Error" on Unbuntu

    Don (2017-11-15 11:53:42 EST)

    On Ubuntu 4.4.0-98-generic hitting “500 Internal Server Error” when trying to mount Box

    sudo mount /home/username/Box
    Please enter the username to authenticate with server
    https://dav.box.com/dav or hit enter for none.
    Username: donbarr@ca.ibm.com
    Please enter the password to authenticate user donbarr@ca.ibm.com with server
    https://dav.box.com/dav or hit enter for none.
    Password:  
    /sbin/mount.davfs: Mounting failed.
    500 Internal Server Error
    

    Used the same credentials going directly to https://dav.box.com/dav in a browser – I get no error but the screen stays blank. So not clear if the passthru to Box isn’t working or something else.

  • Pankaj Mathur
    Wrong permissions on secrets file

    Pankaj Mathur (2017-12-25 14:48:52 EST)

    Doing chmod 400 ~/.davfs2/secrets did the trick for me, thanks for pointing it out!

📮 Leave a comment (Spammers beware: All comments are moderated)

Sorry. There was an error submitting your comment. Please try again, or contact me if the problem persists.
Sending comment; please wait.
Thanks. Your comment was successfully submitted. It will appear here shortly if it isn't spam.