Box
At a glance
Section titled “At a glance”| Capability | Support |
|---|---|
| rclone support tier | Tier 1: Core |
| Checksums | SHA-1 |
| Modification times | Kept, to 1 s |
| Case-insensitive names | Yes |
| Duplicate names allowed | No |
| Server-side copy | Yes |
| Server-side move and rename | Yes |
| Folder move and rename | Yes, in one step |
| Free space reporting | Yes |
| Empty folders | Yes |
| Change notifications | Yes |
| Uploads of unknown size | Yes |
| Public links | Yes |
The initial setup for Box involves getting a token from Box which you
can do either in your browser, or with a config.json downloaded from Box
to use JWT authentication. rclone config walks you through it.
Setup notes
Section titled “Setup notes”In CloudMount you add this drive from the Add drive screen, and the wizard asks for the options listed under Options. The notes below come from rclone’s setup guide.
Using rclone with an Enterprise account with SSO
Section titled “Using rclone with an Enterprise account with SSO”If you have an “Enterprise” account type with Box with single sign on (SSO), you need to create a password to use Box with rclone. This can be done at your Enterprise Box account by going to Settings, “Account” Tab, and then set the password in the “Authentication” field.
Once you have done this, you can setup your Enterprise Box account using the same procedure detailed above in the, using the password you have just set.
Invalid refresh token
Section titled “Invalid refresh token”According to the box docs:
Each refresh_token is valid for one use in 60 days.
This means that if you
- Don’t use the box remote for 60 days
- Copy the config file with a box refresh token in and use it in two places
- Get an error on a token refresh
then rclone will return an error which includes the text Invalid refresh token.
To fix this you will need to use oauth2 again to update the refresh token. You can use the methods in the remote setup docs, bearing in mind that if you use the copy the config file method, you should not use that remote on the computer you did the authentication on.
Here is how to do it.
$ rclone configCurrent remotes:
Name Type==== ====remote box
e) Edit existing remoten) New remoted) Delete remoter) Rename remotec) Copy remotes) Set configuration passwordq) Quit confige/n/d/r/c/s/q> eChoose a number from below, or type in an existing value 1 > remoteremote> remoteConfiguration complete.Options:- type: box- token: {"access_token":"XXX","token_type":"bearer","refresh_token":"XXX","expiry":"2017-07-08T23:40:08.059167677+01:00"}Keep this "remote" remote?Edit remoteValue "client_id" = ""Edit? (y/n)>y) Yesn) Noy/n> nValue "client_secret" = ""Edit? (y/n)>y) Yesn) Noy/n> nRemote configToken already configured - replace it?y) Yesn) Noy/n> yUse web browser to automatically authenticate rclone with remote? * Say Y if the machine running rclone has a web browser you can use * Say N if running rclone on a (remote) machine without web browser accessIf not sure try Y. If Y failed, try N.y) Yesn) Noy/n> yIf your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/authLog in and authorize rclone for accessWaiting for code...Got codeConfiguration complete.Options:- type: box- token: {"access_token":"YYY","token_type":"bearer","refresh_token":"YYY","expiry":"2017-07-23T12:22:29.259137901+01:00"}Keep this "remote" remote?y) Yes this is OKe) Edit this remoted) Delete this remotey/e/d> yModification times and hashes
Section titled “Modification times and hashes”Box allows modification times to be set on objects accurate to 1 second. These will be used to detect whether objects need syncing or not.
Box supports SHA1 type hashes, so you can use the --checksum
flag.
Restricted filename characters
Section titled “Restricted filename characters”In addition to the default restricted characters set the following characters are also replaced:
| Character | Value | Replacement |
|---|---|---|
| \ | 0x5C | \ |
File names can also not end with the following characters. These only get replaced if they are the last character in the name:
| Character | Value | Replacement |
|---|---|---|
| SP | 0x20 | ␠ |
Invalid UTF-8 bytes will also be replaced, as they can’t be used in JSON strings.
Transfers
Section titled “Transfers”For files above 50 MiB rclone will use a chunked transfer. Rclone will
upload up to --transfers chunks at the same time (shared among all
the multipart uploads). Chunks are buffered in memory and are
normally 8 MiB so increasing --transfers will increase memory use.
Deleting files
Section titled “Deleting files”Depending on the enterprise settings for your user, the item will either be actually deleted from Box or moved to the trash.
Emptying the trash is supported via the rclone however cleanup command however this deletes every trashed file and folder individually so it may take a very long time. Emptying the trash via the WebUI does not have this limitation so it is advised to empty the trash via the WebUI.
Root folder ID
Section titled “Root folder ID”You can set the root_folder_id for rclone. This is the directory
(identified by its Folder ID) that rclone considers to be the root
of your Box drive.
Normally you will leave this blank and rclone will determine the correct root to use itself.
However you can set this to restrict rclone to a specific folder hierarchy.
In order to do this you will have to find the Folder ID of the
directory you wish rclone to display. This will be the last segment
of the URL when you open the relevant folder in the Box web
interface.
So if the folder you want rclone to use has a URL which looks like
https://app.box.com/folder/11xxxxxxxxx8
in the browser, then you use 11xxxxxxxxx8 as
the root_folder_id in the config.
Options
Section titled “Options”Standard options
Section titled “Standard options”The wizard asks for these when you add the drive.
client_id
Section titled “client_id”OAuth Client Id.
Leave blank normally.
Type: string
client_secret
Section titled “client_secret”OAuth Client Secret.
Leave blank normally.
Type: string
box_config_file
Section titled “box_config_file”Box App config.json location
Leave blank normally.
Leading ~ will be expanded in the file name as will environment variables such as ${RCLONE_CONFIG_DIR}.
Type: string
access_token
Section titled “access_token”Box App Primary Access Token
Leave blank normally.
Type: string
box_sub_type
Section titled “box_sub_type”Type: string · Default: user
Choices:
user: Rclone should act on behalf of a user.enterprise: Rclone should act on behalf of a service account.
Advanced options
Section titled “Advanced options”The wizard shows these under Advanced options. Most drives work without changing any of them.
OAuth Access Token as a JSON blob.
Type: string
auth_url
Section titled “auth_url”Auth server URL.
Leave blank to use the provider defaults.
Type: string
token_url
Section titled “token_url”Token server url.
Leave blank to use the provider defaults.
Type: string
client_credentials
Section titled “client_credentials”Use client credentials OAuth flow.
This will use the OAUTH2 client Credentials Flow as described in RFC 6749.
Note that this option is NOT supported by all backends.
Type: bool · Default: false
root_folder_id
Section titled “root_folder_id”Fill in for rclone to use a non root folder as its starting point.
Type: string · Default: 0
upload_cutoff
Section titled “upload_cutoff”Cutoff for switching to multipart upload (>= 50 MiB).
Type: SizeSuffix · Default: 50Mi
commit_retries
Section titled “commit_retries”Max number of times to try committing a multipart file.
Type: int · Default: 100
list_chunk
Section titled “list_chunk”Size of listing chunk 1-1000.
Type: int · Default: 1000
owned_by
Section titled “owned_by”Only show items owned by the login (email address) passed in.
Type: string
impersonate
Section titled “impersonate”Impersonate this user ID when using a service account.
Setting this flag allows rclone, when using a JWT service account, to act on behalf of another user by setting the as-user header.
The user ID is the Box identifier for a user. User IDs can found for any user via the GET /users endpoint, which is only available to admins, or by calling the GET /users/me endpoint with an authenticated user session.
See: https://developer.box.com/guides/authentication/jwt/as-user/
Type: string
encoding
Section titled “encoding”The encoding for the backend.
See the encoding section in the overview for more info.
Type: Encoding · Default: Slash,BackSlash,Del,Ctl,RightSpace,InvalidUtf8,Dot
description
Section titled “description”Description of the remote.
Type: string
Limitations
Section titled “Limitations”Note that Box is case insensitive so you can’t have a file called “Hello.doc” and one called “hello.doc”.
Box file names can’t have the \ character in. rclone maps this to
and from an identical looking unicode equivalent \ (U+FF3C Fullwidth
Reverse Solidus).
Box only supports filenames up to 255 characters in length.
Box has API rate limits that sometimes reduce the speed of rclone.
rclone about is not supported by the Box backend. Backends without
this capability cannot determine free space for an rclone mount or
use policy mfs (most free space) as a member of an rclone union
remote.
See List of backends that do not support rclone about and rclone about.
Get your own Box App ID
Section titled “Get your own Box App ID”Here is how to create your own Box App ID for rclone:
-
Go to the Box Developer Console and login, then click
My Appson the sidebar. ClickCreate New Appand selectCustom App. -
In the first screen on the box that pops up, you can pretty much enter whatever you want. The
App Namecan be whatever. ForPurposechoose automation to avoid having to fill out anything else. ClickNext. -
In the second screen of the creation screen, select
User Authentication (OAuth 2.0). Then clickCreate App. -
You should now be on the
Configurationtab of your new app. If not, click on it at the top of the webpage. Copy downClient IDandClient Secret, you’ll need those for rclone. -
Under “OAuth 2.0 Redirect URI”, add
http://127.0.0.1:53682/ -
For
Application Scopes, selectRead all files and folders stored in BoxandWrite all files and folders stored in box(assuming you want to do both). Leave others unchecked. ClickSave Changesat the top right.