github.com/10XDev/rclone@v1.52.3-0.20200626220027-16af9ab76b2a/docs/content/box.md (about)

     1  ---
     2  title: "Box"
     3  description: "Rclone docs for Box"
     4  ---
     5  
     6  {{< icon "fa fa-archive" >}} Box
     7  -----------------------------------------
     8  
     9  Paths are specified as `remote:path`
    10  
    11  Paths may be as deep as required, eg `remote:directory/subdirectory`.
    12  
    13  The initial setup for Box involves getting a token from Box which you
    14  can do either in your browser, or with a config.json downloaded from Box
    15  to use JWT authentication.  `rclone config` walks you through it.
    16  
    17  Here is an example of how to make a remote called `remote`.  First run:
    18  
    19       rclone config
    20  
    21  This will guide you through an interactive setup process:
    22  
    23  ```
    24  No remotes found - make a new one
    25  n) New remote
    26  s) Set configuration password
    27  q) Quit config
    28  n/s/q> n
    29  name> remote
    30  Type of storage to configure.
    31  Choose a number from below, or type in your own value
    32  [snip]
    33  XX / Box
    34     \ "box"
    35  [snip]
    36  Storage> box
    37  Box App Client Id - leave blank normally.
    38  client_id> 
    39  Box App Client Secret - leave blank normally.
    40  client_secret>
    41  Box App config.json location
    42  Leave blank normally.
    43  Enter a string value. Press Enter for the default ("").
    44  config_json>
    45  'enterprise' or 'user' depending on the type of token being requested.
    46  Enter a string value. Press Enter for the default ("user").
    47  box_sub_type>
    48  Remote config
    49  Use auto config?
    50   * Say Y if not sure
    51   * Say N if you are working on a remote or headless machine
    52  y) Yes
    53  n) No
    54  y/n> y
    55  If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
    56  Log in and authorize rclone for access
    57  Waiting for code...
    58  Got code
    59  --------------------
    60  [remote]
    61  client_id = 
    62  client_secret = 
    63  token = {"access_token":"XXX","token_type":"bearer","refresh_token":"XXX","expiry":"XXX"}
    64  --------------------
    65  y) Yes this is OK
    66  e) Edit this remote
    67  d) Delete this remote
    68  y/e/d> y
    69  ```
    70  
    71  See the [remote setup docs](/remote_setup/) for how to set it up on a
    72  machine with no Internet browser available.
    73  
    74  Note that rclone runs a webserver on your local machine to collect the
    75  token as returned from Box. This only runs from the moment it opens
    76  your browser to the moment you get back the verification code.  This
    77  is on `http://127.0.0.1:53682/` and this it may require you to unblock
    78  it temporarily if you are running a host firewall.
    79  
    80  Once configured you can then use `rclone` like this,
    81  
    82  List directories in top level of your Box
    83  
    84      rclone lsd remote:
    85  
    86  List all the files in your Box
    87  
    88      rclone ls remote:
    89  
    90  To copy a local directory to an Box directory called backup
    91  
    92      rclone copy /home/source remote:backup
    93  
    94  ### Using rclone with an Enterprise account with SSO ###
    95  
    96  If you have an "Enterprise" account type with Box with single sign on
    97  (SSO), you need to create a password to use Box with rclone. This can
    98  be done at your Enterprise Box account by going to Settings, "Account"
    99  Tab, and then set the password in the "Authentication" field.
   100  
   101  Once you have done this, you can setup your Enterprise Box account
   102  using the same procedure detailed above in the, using the password you
   103  have just set.
   104  
   105  ### Invalid refresh token ###
   106  
   107  According to the [box docs](https://developer.box.com/v2.0/docs/oauth-20#section-6-using-the-access-and-refresh-tokens):
   108  
   109  > Each refresh_token is valid for one use in 60 days.
   110  
   111  This means that if you
   112  
   113    * Don't use the box remote for 60 days
   114    * Copy the config file with a box refresh token in and use it in two places
   115    * Get an error on a token refresh
   116  
   117  then rclone will return an error which includes the text `Invalid
   118  refresh token`.
   119  
   120  To fix this you will need to use oauth2 again to update the refresh
   121  token.  You can use the methods in [the remote setup
   122  docs](/remote_setup/), bearing in mind that if you use the copy the
   123  config file method, you should not use that remote on the computer you
   124  did the authentication on.
   125  
   126  Here is how to do it.
   127  
   128  ```
   129  $ rclone config
   130  Current remotes:
   131  
   132  Name                 Type
   133  ====                 ====
   134  remote               box
   135  
   136  e) Edit existing remote
   137  n) New remote
   138  d) Delete remote
   139  r) Rename remote
   140  c) Copy remote
   141  s) Set configuration password
   142  q) Quit config
   143  e/n/d/r/c/s/q> e
   144  Choose a number from below, or type in an existing value
   145   1 > remote
   146  remote> remote
   147  --------------------
   148  [remote]
   149  type = box
   150  token = {"access_token":"XXX","token_type":"bearer","refresh_token":"XXX","expiry":"2017-07-08T23:40:08.059167677+01:00"}
   151  --------------------
   152  Edit remote
   153  Value "client_id" = ""
   154  Edit? (y/n)>
   155  y) Yes
   156  n) No
   157  y/n> n
   158  Value "client_secret" = ""
   159  Edit? (y/n)>
   160  y) Yes
   161  n) No
   162  y/n> n
   163  Remote config
   164  Already have a token - refresh?
   165  y) Yes
   166  n) No
   167  y/n> y
   168  Use auto config?
   169   * Say Y if not sure
   170   * Say N if you are working on a remote or headless machine
   171  y) Yes
   172  n) No
   173  y/n> y
   174  If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
   175  Log in and authorize rclone for access
   176  Waiting for code...
   177  Got code
   178  --------------------
   179  [remote]
   180  type = box
   181  token = {"access_token":"YYY","token_type":"bearer","refresh_token":"YYY","expiry":"2017-07-23T12:22:29.259137901+01:00"}
   182  --------------------
   183  y) Yes this is OK
   184  e) Edit this remote
   185  d) Delete this remote
   186  y/e/d> y
   187  ```
   188  
   189  ### Modified time and hashes ###
   190  
   191  Box allows modification times to be set on objects accurate to 1
   192  second.  These will be used to detect whether objects need syncing or
   193  not.
   194  
   195  Box supports SHA1 type hashes, so you can use the `--checksum`
   196  flag.
   197  
   198  #### Restricted filename characters
   199  
   200  In addition to the [default restricted characters set](/overview/#restricted-characters)
   201  the following characters are also replaced:
   202  
   203  | Character | Value | Replacement |
   204  | --------- |:-----:|:-----------:|
   205  | \         | 0x5C  | \           |
   206  
   207  File names can also not end with the following characters.
   208  These only get replaced if they are the last character in the name:
   209  
   210  | Character | Value | Replacement |
   211  | --------- |:-----:|:-----------:|
   212  | SP        | 0x20  | ␠           |
   213  
   214  Invalid UTF-8 bytes will also be [replaced](/overview/#invalid-utf8),
   215  as they can't be used in JSON strings.
   216  
   217  ### Transfers ###
   218  
   219  For files above 50MB rclone will use a chunked transfer.  Rclone will
   220  upload up to `--transfers` chunks at the same time (shared among all
   221  the multipart uploads).  Chunks are buffered in memory and are
   222  normally 8MB so increasing `--transfers` will increase memory use.
   223  
   224  ### Deleting files ###
   225  
   226  Depending on the enterprise settings for your user, the item will
   227  either be actually deleted from Box or moved to the trash.
   228  
   229  ### Root folder ID ###
   230  
   231  You can set the `root_folder_id` for rclone.  This is the directory
   232  (identified by its `Folder ID`) that rclone considers to be the root
   233  of your Box drive.
   234  
   235  Normally you will leave this blank and rclone will determine the
   236  correct root to use itself.
   237  
   238  However you can set this to restrict rclone to a specific folder
   239  hierarchy.
   240  
   241  In order to do this you will have to find the `Folder ID` of the
   242  directory you wish rclone to display.  This will be the last segment
   243  of the URL when you open the relevant folder in the Box web
   244  interface.
   245  
   246  So if the folder you want rclone to use has a URL which looks like
   247  `https://app.box.com/folder/11xxxxxxxxx8`
   248  in the browser, then you use `11xxxxxxxxx8` as
   249  the `root_folder_id` in the config.
   250  
   251  {{< rem autogenerated options start" - DO NOT EDIT - instead edit fs.RegInfo in backend/box/box.go then run make backenddocs" >}}
   252  ### Standard Options
   253  
   254  Here are the standard options specific to box (Box).
   255  
   256  #### --box-client-id
   257  
   258  Box App Client Id.
   259  Leave blank normally.
   260  
   261  - Config:      client_id
   262  - Env Var:     RCLONE_BOX_CLIENT_ID
   263  - Type:        string
   264  - Default:     ""
   265  
   266  #### --box-client-secret
   267  
   268  Box App Client Secret
   269  Leave blank normally.
   270  
   271  - Config:      client_secret
   272  - Env Var:     RCLONE_BOX_CLIENT_SECRET
   273  - Type:        string
   274  - Default:     ""
   275  
   276  #### --box-box-config-file
   277  
   278  Box App config.json location
   279  Leave blank normally.
   280  
   281  - Config:      box_config_file
   282  - Env Var:     RCLONE_BOX_BOX_CONFIG_FILE
   283  - Type:        string
   284  - Default:     ""
   285  
   286  #### --box-box-sub-type
   287  
   288  
   289  
   290  - Config:      box_sub_type
   291  - Env Var:     RCLONE_BOX_BOX_SUB_TYPE
   292  - Type:        string
   293  - Default:     "user"
   294  - Examples:
   295      - "user"
   296          - Rclone should act on behalf of a user
   297      - "enterprise"
   298          - Rclone should act on behalf of a service account
   299  
   300  ### Advanced Options
   301  
   302  Here are the advanced options specific to box (Box).
   303  
   304  #### --box-root-folder-id
   305  
   306  Fill in for rclone to use a non root folder as its starting point.
   307  
   308  - Config:      root_folder_id
   309  - Env Var:     RCLONE_BOX_ROOT_FOLDER_ID
   310  - Type:        string
   311  - Default:     "0"
   312  
   313  #### --box-upload-cutoff
   314  
   315  Cutoff for switching to multipart upload (>= 50MB).
   316  
   317  - Config:      upload_cutoff
   318  - Env Var:     RCLONE_BOX_UPLOAD_CUTOFF
   319  - Type:        SizeSuffix
   320  - Default:     50M
   321  
   322  #### --box-commit-retries
   323  
   324  Max number of times to try committing a multipart file.
   325  
   326  - Config:      commit_retries
   327  - Env Var:     RCLONE_BOX_COMMIT_RETRIES
   328  - Type:        int
   329  - Default:     100
   330  
   331  #### --box-encoding
   332  
   333  This sets the encoding for the backend.
   334  
   335  See: the [encoding section in the overview](/overview/#encoding) for more info.
   336  
   337  - Config:      encoding
   338  - Env Var:     RCLONE_BOX_ENCODING
   339  - Type:        MultiEncoder
   340  - Default:     Slash,BackSlash,Del,Ctl,RightSpace,InvalidUtf8,Dot
   341  
   342  {{< rem autogenerated options stop >}}
   343  
   344  ### Limitations ###
   345  
   346  Note that Box is case insensitive so you can't have a file called
   347  "Hello.doc" and one called "hello.doc".
   348  
   349  Box file names can't have the `\` character in.  rclone maps this to
   350  and from an identical looking unicode equivalent `\`.
   351  
   352  Box only supports filenames up to 255 characters in length.