Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Most people should skip this section and go directly to rclone below

There is no official linux client for box.com. Also, the webdav service will be deprecated Jan 31, 2019, so that's not a viable solution. And the official list of protocols to upload and download files says FTPS (FTP over SSL/TLS) is an option, but the details of that specify no support for SSO users, which means Tufts human user accounts cannot use that method. So the options for linux client usage are very limited.

If FTPS can be used, there is a linux client called lftp for that. You should be able to do this, if you create an external user account (such as utln@exchange.tufts.edu or elist).

The Box API (https://developer.box.com/docs) is expected to continue working. It seems crazy they didn't mention this on the official list of protocols mentioned above.

rclone

In linux there is a client called rclone. This is confirmed functional for now, and I got confirmation from the developer, that it uses the API so he believes it should remain functional. This can be used by a Tufts human user account, or by external accounts.

To create a service account:

To share a folder with an external account:

  • In your personal account, web interface, create a folder.
    • Because you create it in the web interface, you're immediately prompted to Invite Others for Collaboration.
    • Invite the external account. By default, accounts auto-accept invitations.
  • If you already created the folder without using the web interface, you need to use the web interface to share it:
    • Browse to the folder in the box web interface.
    • Click Share > Invite Collaborators.
  • You will own the directory, but the external account will have access to it, which means anything they upload belongs to you and counts toward your storage (not the external account's storage).

How to use rclone:

  • First, you'll need to generate an OAuth token from your local laptop, as follows:
    • To install rclone on a Mac:
      • If you don't already have homebrew installed, install it from https://brew.sh/. Then run the "brew install" command:


        Code Block
        languagetext
        brew install rclone


    • To install rclone on Windows:

    • In a Terminal window:

      • Type this:

        Code Block
        languagetext
        rclone authorize box


      • A web browser will open. Click on "Use Single Sign On (SSO)" and enter your Tufts email address (or if you're using an external account, just login using that account).
      • Click "Grant access to Box"
      • When you're done, go back to your Terminal window. There is a special code displayed that you need to copy for use in the remote setup section, later in this procedure. 

  • Second, to configure a headless linux machine to use this account:

    • Ssh login to some linux machine.

    • Via puppet, or yum, install the rclone package.
    • Run the command:

      Code Block
      languagetext
      rclone config


    • Results:
      No remotes found - make a new one
      n) New remote
      s) Set configuration password
      q) Quit config
      n/s/q>

        


      name>

        


      Type of storage to configure.
      Choose a number from below, or type in your own value

      1 / Alias for a existing remote
      \ "alias"
      2 / Amazon Drive
      \ "amazon cloud drive"
      3 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
      \ "s3"
      4 / Backblaze B2
      \ "b2"
      5 / Box
      \ "box"
      6 / Cache a remote
      \ "cache"
      7 / Dropbox
      \ "dropbox"
      8 / Encrypt/Decrypt a remote
      \ "crypt"
      9 / FTP Connection
      \ "ftp"
      10 / Google Cloud Storage (this is not Google Drive)
      \ "google cloud storage"
      11 / Google Drive
      \ "drive"
      12 / Hubic
      \ "hubic"
      13 / Local Disk
      \ "local"
      14 / Mega
      \ "mega"
      15 / Microsoft Azure Blob Storage
      \ "azureblob"
      16 / Microsoft OneDrive
      \ "onedrive"
      17 / OpenDrive
      \ "opendrive"
      18 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
      \ "swift"
      19 / Pcloud
      \ "pcloud"
      20 / QingCloud Object Storage
      \ "qingstor"
      21 / SSH/SFTP Connection
      \ "sftp"
      22 / Webdav
      \ "webdav"
      23 / Yandex Disk
      \ "yandex"
      24 / http Connection
      \ "http"
      Storage>

        


      Box App Client Id - leave blank normally.
      client_id>

        


      Box App Client Secret - leave blank normally.
      client_secret>

        


      Remote config
      Use auto config?
      * Say Y if not sure
      * Say N if you are working on a remote or headless machine
      y) Yes
      n) No
      y/n>

        


      For this to work, you will need rclone available on a machine that has a web browser available.
      Execute the following on your machine:
      rclone authorize "box"
      Then paste the result below:
      result>

        


      --------------------
      [box]
      type = box
      client_id =
      client_secret =
      token = {"access_token": ... }
      --------------------
      y) Yes this is OK
      e) Edit this remote
      d) Delete this remote
      y/e/d>

        


      Current remotes:

      Name Type
      ==== ====
      box box

      e) Edit existing remote
      n) New remote
      d) Delete remote
      r) Rename remote
      c) Copy remote
      s) Set configuration password
      q) Quit config
      e/n/d/r/c/s/q>

       

    • Note: There is no problem with token expiration. If you look in .config/rclone/rclone.conf, you'll see an access token, expiration date, and refresh token. The access token can be used unlimited times up to the expiration date, which is typically about 1 hour after it was created. After that time, the refresh token is used (and can only be used once) to generate a new access token. This is handled automatically by rclone.

    • You can now use commands from https://rclone.org/docs/ such as:

      Code Block
      languagetext
      rclone lsf box: --max-depth=1   # shows both files and directories, using '/' for dirs
      rclone tree box: --max-depth=3  # shows both files and directories, formatted like a tree
      
      rclone ls box: --max-depth=1    # only shows files
      rclone lsd box: --max-depth=1   # only shows directories
       
      # Sync down from box to local linux directory, skipping unchanged files, also performing deletions if necessary
      rclone sync --dry-run box:somedir ./somedir