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