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.
...
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:
- Contact ESS. They maintain a list of box service accounts with random generated credentials.
- If you are a member of ESS, or you wish to create one yourself, you just need some non-@tufts.edu email address. You could use utln@exchange.tufts.edu or something@elist.tufts.edu
- Go to https://box.com (in a browser you don't normally use, with a private or incognito window) Go to Get Started > Individual Plans > Free.Please see: Box Service Accounts
To share a folder with an external account:
...
- 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 language text brew install rclone
- If you don't already have homebrew installed, install it from https://brew.sh/. Then run the "brew install" command:
To install rclone on Windows:
- https://rclone.org/downloads/
- Extract the zip, and stick the exe file somewhere convenient on your PATH.
In a Terminal window:
Type this:
Code Block language text 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.
- To install rclone on a Mac:
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 language text 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 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 language text 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