Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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>

       

      Highlight
      n
       


      name>

       

      Highlight
      box
       


      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>

       

      Highlight
      box
       


      Box App Client Id - leave blank normally.
      client_id>

       

      Highlight
      Just press enter
       


      Box App Client Secret - leave blank normally.
      client_secret>

       

      Highlight
      Just press enter
       


      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>

       

      Highlight
      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>

       

      Highlight
      {"access_token": ... }
       


      --------------------
      [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>

       

      Highlight
      y
       


      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>

       

      Highlight
      q

    • Bear in mind that OAuth tokens do not last forever. You can see the expiry in the authorization token. At first, it's only good for about 30 minutes, but if you run rclone as a cron job every minute or every few minutes, it will automatically extend the authorization token as it goesNote: 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