github.com/ncw/rclone@v1.48.1-0.20190724201158-a35aa1360e3e/docs/content/box.md (about)

     1  ---
     2  title: "Box"
     3  description: "Rclone docs for Box"
     4  date: "2015-10-14"
     5  ---
     6  
     7  <i class="fa fa-archive"></i> Box
     8  -----------------------------------------
     9  
    10  Paths are specified as `remote:path`
    11  
    12  Paths may be as deep as required, eg `remote:directory/subdirectory`.
    13  
    14  The initial setup for Box involves getting a token from Box which you
    15  need to do in your browser.  `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   1 / Amazon Drive
    33     \ "amazon cloud drive"
    34   2 / Amazon S3 (also Dreamhost, Ceph, Minio)
    35     \ "s3"
    36   3 / Backblaze B2
    37     \ "b2"
    38   4 / Box
    39     \ "box"
    40   5 / Dropbox
    41     \ "dropbox"
    42   6 / Encrypt/Decrypt a remote
    43     \ "crypt"
    44   7 / FTP Connection
    45     \ "ftp"
    46   8 / Google Cloud Storage (this is not Google Drive)
    47     \ "google cloud storage"
    48   9 / Google Drive
    49     \ "drive"
    50  10 / Hubic
    51     \ "hubic"
    52  11 / Local Disk
    53     \ "local"
    54  12 / Microsoft OneDrive
    55     \ "onedrive"
    56  13 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
    57     \ "swift"
    58  14 / SSH/SFTP Connection
    59     \ "sftp"
    60  15 / Yandex Disk
    61     \ "yandex"
    62  16 / http Connection
    63     \ "http"
    64  Storage> box
    65  Box App Client Id - leave blank normally.
    66  client_id> 
    67  Box App Client Secret - leave blank normally.
    68  client_secret> 
    69  Remote config
    70  Use auto config?
    71   * Say Y if not sure
    72   * Say N if you are working on a remote or headless machine
    73  y) Yes
    74  n) No
    75  y/n> y
    76  If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
    77  Log in and authorize rclone for access
    78  Waiting for code...
    79  Got code
    80  --------------------
    81  [remote]
    82  client_id = 
    83  client_secret = 
    84  token = {"access_token":"XXX","token_type":"bearer","refresh_token":"XXX","expiry":"XXX"}
    85  --------------------
    86  y) Yes this is OK
    87  e) Edit this remote
    88  d) Delete this remote
    89  y/e/d> y
    90  ```
    91  
    92  See the [remote setup docs](/remote_setup/) for how to set it up on a
    93  machine with no Internet browser available.
    94  
    95  Note that rclone runs a webserver on your local machine to collect the
    96  token as returned from Box. This only runs from the moment it opens
    97  your browser to the moment you get back the verification code.  This
    98  is on `http://127.0.0.1:53682/` and this it may require you to unblock
    99  it temporarily if you are running a host firewall.
   100  
   101  Once configured you can then use `rclone` like this,
   102  
   103  List directories in top level of your Box
   104  
   105      rclone lsd remote:
   106  
   107  List all the files in your Box
   108  
   109      rclone ls remote:
   110  
   111  To copy a local directory to an Box directory called backup
   112  
   113      rclone copy /home/source remote:backup
   114  
   115  ### Using rclone with an Enterprise account with SSO ###
   116  
   117  If you have an "Enterprise" account type with Box with single sign on
   118  (SSO), you need to create a password to use Box with rclone. This can
   119  be done at your Enterprise Box account by going to Settings, "Account"
   120  Tab, and then set the password in the "Authentication" field.
   121  
   122  Once you have done this, you can setup your Enterprise Box account
   123  using the same procedure detailed above in the, using the password you
   124  have just set.
   125  
   126  ### Invalid refresh token ###
   127  
   128  According to the [box docs](https://developer.box.com/v2.0/docs/oauth-20#section-6-using-the-access-and-refresh-tokens):
   129  
   130  > Each refresh_token is valid for one use in 60 days.
   131  
   132  This means that if you
   133  
   134    * Don't use the box remote for 60 days
   135    * Copy the config file with a box refresh token in and use it in two places
   136    * Get an error on a token refresh
   137  
   138  then rclone will return an error which includes the text `Invalid
   139  refresh token`.
   140  
   141  To fix this you will need to use oauth2 again to update the refresh
   142  token.  You can use the methods in [the remote setup
   143  docs](/remote_setup/), bearing in mind that if you use the copy the
   144  config file method, you should not use that remote on the computer you
   145  did the authentication on.
   146  
   147  Here is how to do it.
   148  
   149  ```
   150  $ rclone config
   151  Current remotes:
   152  
   153  Name                 Type
   154  ====                 ====
   155  remote               box
   156  
   157  e) Edit existing remote
   158  n) New remote
   159  d) Delete remote
   160  r) Rename remote
   161  c) Copy remote
   162  s) Set configuration password
   163  q) Quit config
   164  e/n/d/r/c/s/q> e
   165  Choose a number from below, or type in an existing value
   166   1 > remote
   167  remote> remote
   168  --------------------
   169  [remote]
   170  type = box
   171  token = {"access_token":"XXX","token_type":"bearer","refresh_token":"XXX","expiry":"2017-07-08T23:40:08.059167677+01:00"}
   172  --------------------
   173  Edit remote
   174  Value "client_id" = ""
   175  Edit? (y/n)>
   176  y) Yes
   177  n) No
   178  y/n> n
   179  Value "client_secret" = ""
   180  Edit? (y/n)>
   181  y) Yes
   182  n) No
   183  y/n> n
   184  Remote config
   185  Already have a token - refresh?
   186  y) Yes
   187  n) No
   188  y/n> y
   189  Use auto config?
   190   * Say Y if not sure
   191   * Say N if you are working on a remote or headless machine
   192  y) Yes
   193  n) No
   194  y/n> y
   195  If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
   196  Log in and authorize rclone for access
   197  Waiting for code...
   198  Got code
   199  --------------------
   200  [remote]
   201  type = box
   202  token = {"access_token":"YYY","token_type":"bearer","refresh_token":"YYY","expiry":"2017-07-23T12:22:29.259137901+01:00"}
   203  --------------------
   204  y) Yes this is OK
   205  e) Edit this remote
   206  d) Delete this remote
   207  y/e/d> y
   208  ```
   209  
   210  ### Modified time and hashes ###
   211  
   212  Box allows modification times to be set on objects accurate to 1
   213  second.  These will be used to detect whether objects need syncing or
   214  not.
   215  
   216  Box supports SHA1 type hashes, so you can use the `--checksum`
   217  flag.
   218  
   219  ### Transfers ###
   220  
   221  For files above 50MB rclone will use a chunked transfer.  Rclone will
   222  upload up to `--transfers` chunks at the same time (shared among all
   223  the multipart uploads).  Chunks are buffered in memory and are
   224  normally 8MB so increasing `--transfers` will increase memory use.
   225  
   226  ### Deleting files ###
   227  
   228  Depending on the enterprise settings for your user, the item will
   229  either be actually deleted from Box or moved to the trash.
   230  
   231  <!--- autogenerated options start - DO NOT EDIT, instead edit fs.RegInfo in backend/box/box.go then run make backenddocs -->
   232  ### Standard Options
   233  
   234  Here are the standard options specific to box (Box).
   235  
   236  #### --box-client-id
   237  
   238  Box App Client Id.
   239  Leave blank normally.
   240  
   241  - Config:      client_id
   242  - Env Var:     RCLONE_BOX_CLIENT_ID
   243  - Type:        string
   244  - Default:     ""
   245  
   246  #### --box-client-secret
   247  
   248  Box App Client Secret
   249  Leave blank normally.
   250  
   251  - Config:      client_secret
   252  - Env Var:     RCLONE_BOX_CLIENT_SECRET
   253  - Type:        string
   254  - Default:     ""
   255  
   256  ### Advanced Options
   257  
   258  Here are the advanced options specific to box (Box).
   259  
   260  #### --box-upload-cutoff
   261  
   262  Cutoff for switching to multipart upload (>= 50MB).
   263  
   264  - Config:      upload_cutoff
   265  - Env Var:     RCLONE_BOX_UPLOAD_CUTOFF
   266  - Type:        SizeSuffix
   267  - Default:     50M
   268  
   269  #### --box-commit-retries
   270  
   271  Max number of times to try committing a multipart file.
   272  
   273  - Config:      commit_retries
   274  - Env Var:     RCLONE_BOX_COMMIT_RETRIES
   275  - Type:        int
   276  - Default:     100
   277  
   278  <!--- autogenerated options stop -->
   279  
   280  ### Limitations ###
   281  
   282  Note that Box is case insensitive so you can't have a file called
   283  "Hello.doc" and one called "hello.doc".
   284  
   285  Box file names can't have the `\` character in.  rclone maps this to
   286  and from an identical looking unicode equivalent `\`.
   287  
   288  Box only supports filenames up to 255 characters in length.