Notes for box.com on Linux

Please read VUMC's documentation to get started. The notes below supplement the documentation. Note: VUMC does allow us to use box.com to store files containing certain protect health information. See http://it.vanderbilt.edu/services/box/box-data-policy.php for details.

Before using WebDAV to access Box.com, read WebDAV with Box from Box support. Box no longer supports WebDAV access, but as of August 2021 it still works.

One needs an "external password" to authenticate with Box via WebDAV. Box + SSO: Working with External Passwords explains that.

This site describes how to mount Box.com cloud storage on Linux. *

* If your Nautilus File Manager does not have the Connect to Server box and Connect button at the bottom, you can find it by clicking on the File menu and selecting "Connect to Server...". In this case the Connect to Server dialog should be completed something like this:
  • Connect to Server details. In the Server box enter "davs://dav.box.com/dav". For the password, use your "external password" as explained above.
    ConnectrServerDetails.png

Directory Organization

This is a note from Frank Harrell:

As VUMC has moved to box.com for the "dropbox" type of function, those of you who want to synchronize with a directory on your computer should start planning for how best to do that. On my system I created a root directory /Box and I use linux sync software. For other systems, the sync software is available from box.com. On my system, sync involves using files "in the cloud". Unlike dropbox, the files do not exist on your hard disk but the box file system is "mounted". Caching goes on behind the scene to speed things up.

Don't put your local Box area under your home structure, as we don't want system backups to include it.

UPDATED NOTE: Our backup script uses the rsync --one-file-system option which means "don't cross filesystem boundaries". But if you want to be sure then you can put your box area somewhere else than under your home structure.

Start planning, and think about organizing your Box subdirectories in a logical hierarchical manner (suggestions at http://biostat.app.vumc.org/FolderOrg) so that directories can be shared in the best way for collaboration. Over the years I've found that the structure in FolderOrg is easier to maintain, e.g., /projects has major area then individual project directories, self-contained with data etc., and generics are put in general areas such as /R, /doc, /doc/latex, etc.

Notes

  • Log on problems: If you are having trouble logging on with the Windows or Mac client check this:
    • log on to the web client (https://vumc.box.com)
    • click on the gear icon and then "Account Settings"
    • look in the "Login and Email Addresses" section and see if the email address you are using is there
    • if necessary, add another email address using the "Add more emails" link
  • has versioning built in
  • Comments may be added to files
  • Documents and tutorials at https://success.box.com/
  • Clients exist for Windows, Macintosh, iPhone/iPad, Android, and mobile browsers. There is no box.com supported client for Linux. However, tools do exist for using box.com on Linux computers. See below.
  • Besides the "Syncing in Linux" method below, Box can be used on Linux computers via the web site https://vanderbilt.box.com
  • Is Box HIPAA compliant? The short answer is "no". Vanderbilt Box.com Policy
  • We are provided with enterprise accounts controlled by Vanderbilt. The logon is a "single-sign-on" (SSO) process that uses Vanderbilt credentials. This causes problems with authentication in third party applications like ftp. See https://support.box.com/hc/en-us/articles/200520058-I-m-having-trouble-using-FTP-with-Box.
    • The relevant section says "FTP does not support SSO login credentials. You will need to create a Box specific password to supplement your SSO login. You can do so by visiting https://vanderbilt.app.box.com/settings and selecting Create External Password. This password can be used for external applications that do not support SSO."
    • If you want to use something like box-linux-sync to sync from a Linux computer you will need to use Box specific credentials.
  • FileZilla settings for connecting to Box account. Uses Vanderbilt email address as the username. The password is the Box external password described in the previous bullet point. This note is included as an example of working with a third party application.
    boxfilezilla.png
  • File types blocked by Sync. The following file types are blocked and unsupported by Sync:
    • Temporary files and folders (.tmp and files/folders starting with ~ character)
    • System and hidden files
    • Windows shortcuts
    • Box WebDocs
    • Outlook PST files
    • QuickBook files
    • Google Docs/Spreadsheets
  • Even though the box web app can be used to create Box WebDoc and Google Doc files, those files are not handled by the installed box-sync application! They just don't show up in the box sync folder.

Syncing in Linux

  • Running box-sync start (see below) will start syncing and it will continue until box-sync stop or you reboot
  • Current versions of all files on box.com will be available
  • These are "remote mounted" so you are actually accessing the cloud dynamically and no space is taken up on your hard disk
  • Files are cache so access is faster on repeated use
  • See https://github.com/noiselabs/box-linux-sync
  • Linux installation (let uid be your user name)

sudo apt-get install davfs2
cd ~/bin
git clone git://github.com/noiselabs/box-linux-sync.git
cd ~/bin/box-linux-sync/bin
./box-sync check
Edit ~/.noiselabs/box/box-sync.cfg to make box_dir=/Box
sudo mkdir /Box
sudo chown uid.uid /Box
Add to ~/.bashrc: path to ~/bin/box-linux-sync/bin/
source ~/.bashrc      to incorporate new path
box-sync setup
sudo chmod u+s /sbin/mount.davfs
box-sync --help
box-sync start       to mount /Box
box-sync stop       to dismount /Box file system

Accessing from R

You can access files from your Box account in R by using the curl and XML packages via the WebDAV protocol. To do this, you first need to generate an external password for Box. The external password may be created by visiting the following location on the Box website: Account Settings > Account tab > Create External Password. Once you have your external password, you can use the following R function to list files in your Box folder:

library(curl)
library(XML)

listFiles <- function(username, password, relPath = "/", dav = "https://dav.box.com/dav") {
  uri <- URLencode(paste(dav, relPath, sep=""))

  # fetch directory listing via curl and parse XML response
  h <- new_handle()
  handle_setopt(h, customrequest = "PROPFIND")
  handle_setopt(h, username = username)
  handle_setopt(h, password = password)
  response <- curl_fetch_memory(uri, h)
  text <- rawToChar(response$content)
  doc <- xmlParse(text, asText=TRUE)

  # calculate relative paths
  base <- paste(paste("/", strsplit(uri, "/")[[1]][-1:-3], sep="", collapse=""), "/", sep="")
  result <- unlist(
    xpathApply(doc, "//d:response/d:href", function(node) {
      sub(base, "", URLdecode(xmlValue(node)), fixed=TRUE)
    })
  )
  result[result != ""]
}

The username parameter for this function refers to your Vanderbilt e-mail address. The password parameter refers to your external Box password. Do not save your external Box password in an R source file. For more information about Box's WebDAV support, see https://community.box.com/t5/Managing-Your-Content/Does-Box-support-WebDAV/ta-p/310

Topic attachments
I Attachment Action Size Date Who Comment
ConnectrServerDetails.pngpng ConnectrServerDetails.png manage 33.7 K 20 Aug 2021 - 14:57 DalePlummer  
boxfilezilla.pngpng boxfilezilla.png manage 40.0 K 18 Mar 2014 - 14:48 DalePlummer  
rocket-slideshow.pdfpdf rocket-slideshow.pdf manage 1745.0 K 19 Mar 2014 - 09:22 DalePlummer  
Topic revision: r23 - 20 Aug 2021, DalePlummer
 

This site is powered by FoswikiCopyright © 2013-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback