2017-07-09 00:31:58 +02:00
---
title: "Box"
description: "Rclone docs for Box"
2022-11-17 18:56:24 +01:00
versionIntroduced: "v1.38"
2017-07-09 00:31:58 +02:00
---
2021-07-20 20:45:41 +02:00
# {{< icon "fa fa-archive" >}} Box
2017-07-09 00:31:58 +02:00
Paths are specified as `remote:path`
2020-10-13 23:49:58 +02:00
Paths may be as deep as required, e.g. `remote:directory/subdirectory` .
2017-07-09 00:31:58 +02:00
The initial setup for Box involves getting a token from Box which you
2019-09-20 14:26:53 +02:00
can do either in your browser, or with a config.json downloaded from Box
to use JWT authentication. `rclone config` walks you through it.
2017-07-09 00:31:58 +02:00
2021-10-14 15:40:18 +02:00
## Configuration
2017-07-09 00:31:58 +02:00
Here is an example of how to make a remote called `remote` . First run:
rclone config
This will guide you through an interactive setup process:
```
2021-11-01 21:34:46 +01:00
No remotes found, make a new one?
2017-07-09 00:31:58 +02:00
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> remote
Type of storage to configure.
Choose a number from below, or type in your own value
2019-08-26 11:47:17 +02:00
[snip]
XX / Box
2017-07-09 00:31:58 +02:00
\ "box"
2019-08-26 11:47:17 +02:00
[snip]
2017-07-09 00:31:58 +02:00
Storage> box
Box App Client Id - leave blank normally.
client_id>
Box App Client Secret - leave blank normally.
2019-09-20 14:26:53 +02:00
client_secret>
Box App config.json location
Leave blank normally.
Enter a string value. Press Enter for the default ("").
2020-05-22 11:59:45 +02:00
box_config_file>
Box App Primary Access Token
Leave blank normally.
Enter a string value. Press Enter for the default ("").
access_token>
2019-09-20 14:26:53 +02:00
Enter a string value. Press Enter for the default ("user").
2020-05-22 11:59:45 +02:00
Choose a number from below, or type in your own value
1 / Rclone should act on behalf of a user
\ "user"
2 / Rclone should act on behalf of a service account
\ "enterprise"
2019-09-20 14:26:53 +02:00
box_sub_type>
2017-07-09 00:31:58 +02:00
Remote config
2022-12-07 20:44:28 +01:00
Use 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 access
If not sure try Y. If Y failed, try N.
2017-07-09 00:31:58 +02:00
y) Yes
n) No
y/n> y
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...
Got code
--------------------
[remote]
client_id =
client_secret =
token = {"access_token":"XXX","token_type":"bearer","refresh_token":"XXX","expiry":"XXX"}
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
```
See the [remote setup docs ](/remote_setup/ ) for how to set it up on a
machine with no Internet browser available.
Note that rclone runs a webserver on your local machine to collect the
token as returned from Box. This only runs from the moment it opens
your browser to the moment you get back the verification code. This
is on `http://127.0.0.1:53682/` and this it may require you to unblock
it temporarily if you are running a host firewall.
Once configured you can then use `rclone` like this,
List directories in top level of your Box
rclone lsd remote:
List all the files in your Box
rclone ls remote:
To copy a local directory to an Box directory called backup
rclone copy /home/source remote:backup
2021-10-14 15:40:18 +02:00
### Using rclone with an Enterprise account with SSO
2019-02-05 15:29:13 +01:00
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.
2021-10-14 15:40:18 +02:00
### Invalid refresh token
2017-07-09 00:31:58 +02:00
According to the [box docs ](https://developer.box.com/v2.0/docs/oauth-20#section-6-using-the-access-and-refresh-tokens ):
> 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](/remote_setup/), 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 config
Current remotes:
Name Type
==== ====
remote 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> e
Choose a number from below, or type in an existing value
1 > remote
remote> remote
--------------------
[remote]
type = box
token = {"access_token":"XXX","token_type":"bearer","refresh_token":"XXX","expiry":"2017-07-08T23:40:08.059167677+01:00"}
--------------------
Edit remote
Value "client_id" = ""
Edit? (y/n)>
y) Yes
n) No
y/n> n
Value "client_secret" = ""
Edit? (y/n)>
y) Yes
n) No
y/n> n
Remote config
Already have a token - refresh?
y) Yes
n) No
y/n> y
2022-12-07 20:44:28 +01:00
Use 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 access
If not sure try Y. If Y failed, try N.
2017-07-09 00:31:58 +02:00
y) Yes
n) No
y/n> y
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...
Got code
--------------------
[remote]
type = box
token = {"access_token":"YYY","token_type":"bearer","refresh_token":"YYY","expiry":"2017-07-23T12:22:29.259137901+01:00"}
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
```
2021-10-14 15:40:18 +02:00
### Modified time and hashes
2017-07-09 00:31:58 +02:00
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.
2018-08-09 21:03:26 +02:00
Box supports SHA1 type hashes, so you can use the `--checksum`
2017-07-09 00:31:58 +02:00
flag.
2021-10-14 15:40:18 +02:00
### Restricted filename characters
2018-11-02 13:13:01 +01:00
In addition to the [default restricted characters set ](/overview/#restricted-characters )
the following characters are also replaced:
| Character | Value | Replacement |
| --------- |:-----:|:-----------:|
| \ | 0x5C | \ |
File names can also not end with the following characters.
2020-05-26 01:30:30 +02:00
These only get replaced if they are the last character in the name:
2018-11-02 13:13:01 +01:00
| Character | Value | Replacement |
| --------- |:-----:|:-----------:|
| SP | 0x20 | ␠ |
Invalid UTF-8 bytes will also be [replaced ](/overview/#invalid-utf8 ),
as they can't be used in JSON strings.
2021-10-14 15:40:18 +02:00
### Transfers
2017-07-09 00:31:58 +02:00
2021-03-02 20:11:57 +01:00
For files above 50 MiB rclone will use a chunked transfer. Rclone will
2017-07-09 00:31:58 +02:00
upload up to `--transfers` chunks at the same time (shared among all
the multipart uploads). Chunks are buffered in memory and are
2021-03-02 20:11:57 +01:00
normally 8 MiB so increasing `--transfers` will increase memory use.
2017-07-09 00:31:58 +02:00
2021-10-14 15:40:18 +02:00
### Deleting files
2017-07-09 00:31:58 +02:00
Depending on the enterprise settings for your user, the item will
either be actually deleted from Box or moved to the trash.
2020-06-17 14:13:50 +02:00
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.
2021-10-14 15:40:18 +02:00
### Root folder ID
2020-04-21 16:34:56 +02:00
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.
2020-05-22 13:22:52 +02:00
{{< rem autogenerated options start " - DO NOT EDIT - instead edit fs . RegInfo in backend / box / box . go then run make backenddocs " > }}
2021-11-01 16:42:05 +01:00
### Standard options
2018-10-01 21:48:54 +02:00
2022-07-09 19:08:20 +02:00
Here are the Standard options specific to box (Box).
2018-10-01 21:48:54 +02:00
#### --box-client-id
2021-11-01 16:42:05 +01:00
OAuth Client Id.
2018-10-01 21:48:54 +02:00
Leave blank normally.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: client_id
- Env Var: RCLONE_BOX_CLIENT_ID
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2018-10-01 21:48:54 +02:00
#### --box-client-secret
2021-11-01 16:42:05 +01:00
OAuth Client Secret.
2018-10-01 21:48:54 +02:00
Leave blank normally.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: client_secret
- Env Var: RCLONE_BOX_CLIENT_SECRET
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2018-10-01 21:48:54 +02:00
2019-10-26 12:04:54 +02:00
#### --box-box-config-file
Box App config.json location
2021-11-01 16:42:05 +01:00
2019-10-26 12:04:54 +02:00
Leave blank normally.
2020-09-02 17:59:04 +02:00
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}` .
2022-03-18 13:29:54 +01:00
Properties:
2019-10-26 12:04:54 +02:00
- Config: box_config_file
- Env Var: RCLONE_BOX_BOX_CONFIG_FILE
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2019-10-26 12:04:54 +02:00
2020-09-02 17:59:04 +02:00
#### --box-access-token
Box App Primary Access Token
2021-11-01 16:42:05 +01:00
2020-09-02 17:59:04 +02:00
Leave blank normally.
2022-03-18 13:29:54 +01:00
Properties:
2020-09-02 17:59:04 +02:00
- Config: access_token
- Env Var: RCLONE_BOX_ACCESS_TOKEN
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2020-09-02 17:59:04 +02:00
2019-10-26 12:04:54 +02:00
#### --box-box-sub-type
2022-03-18 13:29:54 +01:00
Properties:
2019-10-26 12:04:54 +02:00
- Config: box_sub_type
- Env Var: RCLONE_BOX_BOX_SUB_TYPE
- Type: string
- Default: "user"
- Examples:
- "user"
2021-11-01 16:42:05 +01:00
- Rclone should act on behalf of a user.
2019-10-26 12:04:54 +02:00
- "enterprise"
2021-11-01 16:42:05 +01:00
- Rclone should act on behalf of a service account.
2019-10-26 12:04:54 +02:00
2021-11-01 16:42:05 +01:00
### Advanced options
2018-10-01 21:48:54 +02:00
2022-07-09 19:08:20 +02:00
Here are the Advanced options specific to box (Box).
2018-10-01 21:48:54 +02:00
2020-09-02 17:59:04 +02:00
#### --box-token
OAuth Access Token as a JSON blob.
2022-03-18 13:29:54 +01:00
Properties:
2020-09-02 17:59:04 +02:00
- Config: token
- Env Var: RCLONE_BOX_TOKEN
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2020-09-02 17:59:04 +02:00
#### --box-auth-url
Auth server URL.
2021-11-01 16:42:05 +01:00
2020-09-02 17:59:04 +02:00
Leave blank to use the provider defaults.
2022-03-18 13:29:54 +01:00
Properties:
2020-09-02 17:59:04 +02:00
- Config: auth_url
- Env Var: RCLONE_BOX_AUTH_URL
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2020-09-02 17:59:04 +02:00
#### --box-token-url
Token server url.
2021-11-01 16:42:05 +01:00
2020-09-02 17:59:04 +02:00
Leave blank to use the provider defaults.
2022-03-18 13:29:54 +01:00
Properties:
2020-09-02 17:59:04 +02:00
- Config: token_url
- Env Var: RCLONE_BOX_TOKEN_URL
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2020-09-02 17:59:04 +02:00
2020-04-21 16:34:56 +02:00
#### --box-root-folder-id
Fill in for rclone to use a non root folder as its starting point.
2022-03-18 13:29:54 +01:00
Properties:
2020-04-21 16:34:56 +02:00
- Config: root_folder_id
- Env Var: RCLONE_BOX_ROOT_FOLDER_ID
- Type: string
- Default: "0"
2018-10-01 21:48:54 +02:00
#### --box-upload-cutoff
2021-03-02 20:11:57 +01:00
Cutoff for switching to multipart upload (>= 50 MiB).
2018-10-01 21:48:54 +02:00
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: upload_cutoff
- Env Var: RCLONE_BOX_UPLOAD_CUTOFF
- Type: SizeSuffix
2021-07-20 20:45:41 +02:00
- Default: 50Mi
2018-10-01 21:48:54 +02:00
#### --box-commit-retries
Max number of times to try committing a multipart file.
2022-03-18 13:29:54 +01:00
Properties:
2018-10-01 21:48:54 +02:00
- Config: commit_retries
- Env Var: RCLONE_BOX_COMMIT_RETRIES
- Type: int
- Default: 100
2021-11-01 16:42:05 +01:00
#### --box-list-chunk
Size of listing chunk 1-1000.
2022-03-18 13:29:54 +01:00
Properties:
2021-11-01 16:42:05 +01:00
- Config: list_chunk
- Env Var: RCLONE_BOX_LIST_CHUNK
- Type: int
- Default: 1000
#### --box-owned-by
Only show items owned by the login (email address) passed in.
2022-03-18 13:29:54 +01:00
Properties:
2021-11-01 16:42:05 +01:00
- Config: owned_by
- Env Var: RCLONE_BOX_OWNED_BY
- Type: string
2022-03-18 13:29:54 +01:00
- Required: false
2021-11-01 16:42:05 +01:00
2020-02-01 11:31:42 +01:00
#### --box-encoding
2022-03-18 13:29:54 +01:00
The encoding for the backend.
2020-02-01 11:31:42 +01:00
2021-11-01 16:42:05 +01:00
See the [encoding section in the overview ](/overview/#encoding ) for more info.
2020-02-01 11:31:42 +01:00
2022-03-18 13:29:54 +01:00
Properties:
2020-02-01 11:31:42 +01:00
- Config: encoding
- Env Var: RCLONE_BOX_ENCODING
- Type: MultiEncoder
- Default: Slash,BackSlash,Del,Ctl,RightSpace,InvalidUtf8,Dot
2020-05-22 13:22:52 +02:00
{{< rem autogenerated options stop > }}
2018-07-09 18:12:18 +02:00
2021-10-14 15:40:18 +02:00
## Limitations
2017-07-09 00:31:58 +02:00
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
2020-10-03 20:11:06 +02:00
and from an identical looking unicode equivalent `\ ` (U+FF3C Fullwidth
Reverse Solidus).
2017-07-09 00:31:58 +02:00
Box only supports filenames up to 255 characters in length.
2020-11-27 15:08:52 +01:00
`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.
2022-05-14 00:06:45 +02:00
See [List of backends that do not support rclone about ](https://rclone.org/overview/#optional-features ) and [rclone about ](https://rclone.org/commands/rclone_about/ )
2020-11-27 15:08:52 +01:00