github.com/xhghs/rclone@v1.51.1-0.20200430155106-e186a28cced8/docs/content/swift.md (about)

     1  ---
     2  title: "Swift"
     3  description: "Swift"
     4  date: "2014-04-26"
     5  ---
     6  
     7  <i class="fa fa-space-shuttle"></i>Swift
     8  ----------------------------------------
     9  
    10  Swift refers to [Openstack Object Storage](https://docs.openstack.org/swift/latest/).
    11  Commercial implementations of that being:
    12  
    13    * [Rackspace Cloud Files](https://www.rackspace.com/cloud/files/)
    14    * [Memset Memstore](https://www.memset.com/cloud/storage/)
    15    * [OVH Object Storage](https://www.ovh.co.uk/public-cloud/storage/object-storage/)
    16    * [Oracle Cloud Storage](https://cloud.oracle.com/storage-opc)
    17    * [IBM Bluemix Cloud ObjectStorage Swift](https://console.bluemix.net/docs/infrastructure/objectstorage-swift/index.html)
    18  
    19  Paths are specified as `remote:container` (or `remote:` for the `lsd`
    20  command.)  You may put subdirectories in too, eg `remote:container/path/to/dir`.
    21  
    22  Here is an example of making a swift configuration.  First run
    23  
    24      rclone config
    25  
    26  This will guide you through an interactive setup process.
    27  
    28  ```
    29  No remotes found - make a new one
    30  n) New remote
    31  s) Set configuration password
    32  q) Quit config
    33  n/s/q> n
    34  name> remote
    35  Type of storage to configure.
    36  Choose a number from below, or type in your own value
    37  [snip]
    38  XX / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
    39     \ "swift"
    40  [snip]
    41  Storage> swift
    42  Get swift credentials from environment variables in standard OpenStack form.
    43  Choose a number from below, or type in your own value
    44   1 / Enter swift credentials in the next step
    45     \ "false"
    46   2 / Get swift credentials from environment vars. Leave other fields blank if using this.
    47     \ "true"
    48  env_auth> true
    49  User name to log in (OS_USERNAME).
    50  user> 
    51  API key or password (OS_PASSWORD).
    52  key> 
    53  Authentication URL for server (OS_AUTH_URL).
    54  Choose a number from below, or type in your own value
    55   1 / Rackspace US
    56     \ "https://auth.api.rackspacecloud.com/v1.0"
    57   2 / Rackspace UK
    58     \ "https://lon.auth.api.rackspacecloud.com/v1.0"
    59   3 / Rackspace v2
    60     \ "https://identity.api.rackspacecloud.com/v2.0"
    61   4 / Memset Memstore UK
    62     \ "https://auth.storage.memset.com/v1.0"
    63   5 / Memset Memstore UK v2
    64     \ "https://auth.storage.memset.com/v2.0"
    65   6 / OVH
    66     \ "https://auth.cloud.ovh.net/v3"
    67  auth> 
    68  User ID to log in - optional - most swift systems use user and leave this blank (v3 auth) (OS_USER_ID).
    69  user_id> 
    70  User domain - optional (v3 auth) (OS_USER_DOMAIN_NAME)
    71  domain> 
    72  Tenant name - optional for v1 auth, this or tenant_id required otherwise (OS_TENANT_NAME or OS_PROJECT_NAME)
    73  tenant> 
    74  Tenant ID - optional for v1 auth, this or tenant required otherwise (OS_TENANT_ID)
    75  tenant_id> 
    76  Tenant domain - optional (v3 auth) (OS_PROJECT_DOMAIN_NAME)
    77  tenant_domain> 
    78  Region name - optional (OS_REGION_NAME)
    79  region> 
    80  Storage URL - optional (OS_STORAGE_URL)
    81  storage_url> 
    82  Auth Token from alternate authentication - optional (OS_AUTH_TOKEN)
    83  auth_token> 
    84  AuthVersion - optional - set to (1,2,3) if your auth URL has no version (ST_AUTH_VERSION)
    85  auth_version> 
    86  Endpoint type to choose from the service catalogue (OS_ENDPOINT_TYPE)
    87  Choose a number from below, or type in your own value
    88   1 / Public (default, choose this if not sure)
    89     \ "public"
    90   2 / Internal (use internal service net)
    91     \ "internal"
    92   3 / Admin
    93     \ "admin"
    94  endpoint_type> 
    95  Remote config
    96  --------------------
    97  [test]
    98  env_auth = true
    99  user = 
   100  key = 
   101  auth = 
   102  user_id = 
   103  domain = 
   104  tenant = 
   105  tenant_id = 
   106  tenant_domain = 
   107  region = 
   108  storage_url = 
   109  auth_token = 
   110  auth_version = 
   111  endpoint_type = 
   112  --------------------
   113  y) Yes this is OK
   114  e) Edit this remote
   115  d) Delete this remote
   116  y/e/d> y
   117  ```
   118  
   119  This remote is called `remote` and can now be used like this
   120  
   121  See all containers
   122  
   123      rclone lsd remote:
   124  
   125  Make a new container
   126  
   127      rclone mkdir remote:container
   128  
   129  List the contents of a container
   130  
   131      rclone ls remote:container
   132  
   133  Sync `/home/local/directory` to the remote container, deleting any
   134  excess files in the container.
   135  
   136      rclone sync /home/local/directory remote:container
   137  
   138  ### Configuration from an OpenStack credentials file ###
   139  
   140  An OpenStack credentials file typically looks something something
   141  like this (without the comments)
   142  
   143  ```
   144  export OS_AUTH_URL=https://a.provider.net/v2.0
   145  export OS_TENANT_ID=ffffffffffffffffffffffffffffffff
   146  export OS_TENANT_NAME="1234567890123456"
   147  export OS_USERNAME="123abc567xy"
   148  echo "Please enter your OpenStack Password: "
   149  read -sr OS_PASSWORD_INPUT
   150  export OS_PASSWORD=$OS_PASSWORD_INPUT
   151  export OS_REGION_NAME="SBG1"
   152  if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi
   153  ```
   154  
   155  The config file needs to look something like this where `$OS_USERNAME`
   156  represents the value of the `OS_USERNAME` variable - `123abc567xy` in
   157  the example above.
   158  
   159  ```
   160  [remote]
   161  type = swift
   162  user = $OS_USERNAME
   163  key = $OS_PASSWORD
   164  auth = $OS_AUTH_URL
   165  tenant = $OS_TENANT_NAME
   166  ```
   167  
   168  Note that you may (or may not) need to set `region` too - try without first.
   169  
   170  ### Configuration from the environment ###
   171  
   172  If you prefer you can configure rclone to use swift using a standard
   173  set of OpenStack environment variables.
   174  
   175  When you run through the config, make sure you choose `true` for
   176  `env_auth` and leave everything else blank.
   177  
   178  rclone will then set any empty config parameters from the environment
   179  using standard OpenStack environment variables.  There is [a list of
   180  the
   181  variables](https://godoc.org/github.com/ncw/swift#Connection.ApplyEnvironment)
   182  in the docs for the swift library.
   183  
   184  ### Using an alternate authentication method ###
   185  
   186  If your OpenStack installation uses a non-standard authentication method
   187  that might not be yet supported by rclone or the underlying swift library, 
   188  you can authenticate externally (e.g. calling manually the `openstack` 
   189  commands to get a token). Then, you just need to pass the two 
   190  configuration variables ``auth_token`` and ``storage_url``. 
   191  If they are both provided, the other variables are ignored. rclone will 
   192  not try to authenticate but instead assume it is already authenticated 
   193  and use these two variables to access the OpenStack installation.
   194  
   195  #### Using rclone without a config file ####
   196  
   197  You can use rclone with swift without a config file, if desired, like
   198  this:
   199  
   200  ```
   201  source openstack-credentials-file
   202  export RCLONE_CONFIG_MYREMOTE_TYPE=swift
   203  export RCLONE_CONFIG_MYREMOTE_ENV_AUTH=true
   204  rclone lsd myremote:
   205  ```
   206  
   207  ### --fast-list ###
   208  
   209  This remote supports `--fast-list` which allows you to use fewer
   210  transactions in exchange for more memory. See the [rclone
   211  docs](/docs/#fast-list) for more details.
   212  
   213  ### --update and --use-server-modtime ###
   214  
   215  As noted below, the modified time is stored on metadata on the object. It is
   216  used by default for all operations that require checking the time a file was
   217  last updated. It allows rclone to treat the remote more like a true filesystem,
   218  but it is inefficient because it requires an extra API call to retrieve the
   219  metadata.
   220  
   221  For many operations, the time the object was last uploaded to the remote is
   222  sufficient to determine if it is "dirty". By using `--update` along with
   223  `--use-server-modtime`, you can avoid the extra API call and simply upload
   224  files whose local modtime is newer than the time it was last uploaded.
   225  
   226  <!--- autogenerated options start - DO NOT EDIT, instead edit fs.RegInfo in backend/swift/swift.go then run make backenddocs -->
   227  ### Standard Options
   228  
   229  Here are the standard options specific to swift (Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)).
   230  
   231  #### --swift-env-auth
   232  
   233  Get swift credentials from environment variables in standard OpenStack form.
   234  
   235  - Config:      env_auth
   236  - Env Var:     RCLONE_SWIFT_ENV_AUTH
   237  - Type:        bool
   238  - Default:     false
   239  - Examples:
   240      - "false"
   241          - Enter swift credentials in the next step
   242      - "true"
   243          - Get swift credentials from environment vars. Leave other fields blank if using this.
   244  
   245  #### --swift-user
   246  
   247  User name to log in (OS_USERNAME).
   248  
   249  - Config:      user
   250  - Env Var:     RCLONE_SWIFT_USER
   251  - Type:        string
   252  - Default:     ""
   253  
   254  #### --swift-key
   255  
   256  API key or password (OS_PASSWORD).
   257  
   258  - Config:      key
   259  - Env Var:     RCLONE_SWIFT_KEY
   260  - Type:        string
   261  - Default:     ""
   262  
   263  #### --swift-auth
   264  
   265  Authentication URL for server (OS_AUTH_URL).
   266  
   267  - Config:      auth
   268  - Env Var:     RCLONE_SWIFT_AUTH
   269  - Type:        string
   270  - Default:     ""
   271  - Examples:
   272      - "https://auth.api.rackspacecloud.com/v1.0"
   273          - Rackspace US
   274      - "https://lon.auth.api.rackspacecloud.com/v1.0"
   275          - Rackspace UK
   276      - "https://identity.api.rackspacecloud.com/v2.0"
   277          - Rackspace v2
   278      - "https://auth.storage.memset.com/v1.0"
   279          - Memset Memstore UK
   280      - "https://auth.storage.memset.com/v2.0"
   281          - Memset Memstore UK v2
   282      - "https://auth.cloud.ovh.net/v3"
   283          - OVH
   284  
   285  #### --swift-user-id
   286  
   287  User ID to log in - optional - most swift systems use user and leave this blank (v3 auth) (OS_USER_ID).
   288  
   289  - Config:      user_id
   290  - Env Var:     RCLONE_SWIFT_USER_ID
   291  - Type:        string
   292  - Default:     ""
   293  
   294  #### --swift-domain
   295  
   296  User domain - optional (v3 auth) (OS_USER_DOMAIN_NAME)
   297  
   298  - Config:      domain
   299  - Env Var:     RCLONE_SWIFT_DOMAIN
   300  - Type:        string
   301  - Default:     ""
   302  
   303  #### --swift-tenant
   304  
   305  Tenant name - optional for v1 auth, this or tenant_id required otherwise (OS_TENANT_NAME or OS_PROJECT_NAME)
   306  
   307  - Config:      tenant
   308  - Env Var:     RCLONE_SWIFT_TENANT
   309  - Type:        string
   310  - Default:     ""
   311  
   312  #### --swift-tenant-id
   313  
   314  Tenant ID - optional for v1 auth, this or tenant required otherwise (OS_TENANT_ID)
   315  
   316  - Config:      tenant_id
   317  - Env Var:     RCLONE_SWIFT_TENANT_ID
   318  - Type:        string
   319  - Default:     ""
   320  
   321  #### --swift-tenant-domain
   322  
   323  Tenant domain - optional (v3 auth) (OS_PROJECT_DOMAIN_NAME)
   324  
   325  - Config:      tenant_domain
   326  - Env Var:     RCLONE_SWIFT_TENANT_DOMAIN
   327  - Type:        string
   328  - Default:     ""
   329  
   330  #### --swift-region
   331  
   332  Region name - optional (OS_REGION_NAME)
   333  
   334  - Config:      region
   335  - Env Var:     RCLONE_SWIFT_REGION
   336  - Type:        string
   337  - Default:     ""
   338  
   339  #### --swift-storage-url
   340  
   341  Storage URL - optional (OS_STORAGE_URL)
   342  
   343  - Config:      storage_url
   344  - Env Var:     RCLONE_SWIFT_STORAGE_URL
   345  - Type:        string
   346  - Default:     ""
   347  
   348  #### --swift-auth-token
   349  
   350  Auth Token from alternate authentication - optional (OS_AUTH_TOKEN)
   351  
   352  - Config:      auth_token
   353  - Env Var:     RCLONE_SWIFT_AUTH_TOKEN
   354  - Type:        string
   355  - Default:     ""
   356  
   357  #### --swift-application-credential-id
   358  
   359  Application Credential ID (OS_APPLICATION_CREDENTIAL_ID)
   360  
   361  - Config:      application_credential_id
   362  - Env Var:     RCLONE_SWIFT_APPLICATION_CREDENTIAL_ID
   363  - Type:        string
   364  - Default:     ""
   365  
   366  #### --swift-application-credential-name
   367  
   368  Application Credential Name (OS_APPLICATION_CREDENTIAL_NAME)
   369  
   370  - Config:      application_credential_name
   371  - Env Var:     RCLONE_SWIFT_APPLICATION_CREDENTIAL_NAME
   372  - Type:        string
   373  - Default:     ""
   374  
   375  #### --swift-application-credential-secret
   376  
   377  Application Credential Secret (OS_APPLICATION_CREDENTIAL_SECRET)
   378  
   379  - Config:      application_credential_secret
   380  - Env Var:     RCLONE_SWIFT_APPLICATION_CREDENTIAL_SECRET
   381  - Type:        string
   382  - Default:     ""
   383  
   384  #### --swift-auth-version
   385  
   386  AuthVersion - optional - set to (1,2,3) if your auth URL has no version (ST_AUTH_VERSION)
   387  
   388  - Config:      auth_version
   389  - Env Var:     RCLONE_SWIFT_AUTH_VERSION
   390  - Type:        int
   391  - Default:     0
   392  
   393  #### --swift-endpoint-type
   394  
   395  Endpoint type to choose from the service catalogue (OS_ENDPOINT_TYPE)
   396  
   397  - Config:      endpoint_type
   398  - Env Var:     RCLONE_SWIFT_ENDPOINT_TYPE
   399  - Type:        string
   400  - Default:     "public"
   401  - Examples:
   402      - "public"
   403          - Public (default, choose this if not sure)
   404      - "internal"
   405          - Internal (use internal service net)
   406      - "admin"
   407          - Admin
   408  
   409  #### --swift-storage-policy
   410  
   411  The storage policy to use when creating a new container
   412  
   413  This applies the specified storage policy when creating a new
   414  container. The policy cannot be changed afterwards. The allowed
   415  configuration values and their meaning depend on your Swift storage
   416  provider.
   417  
   418  - Config:      storage_policy
   419  - Env Var:     RCLONE_SWIFT_STORAGE_POLICY
   420  - Type:        string
   421  - Default:     ""
   422  - Examples:
   423      - ""
   424          - Default
   425      - "pcs"
   426          - OVH Public Cloud Storage
   427      - "pca"
   428          - OVH Public Cloud Archive
   429  
   430  ### Advanced Options
   431  
   432  Here are the advanced options specific to swift (Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)).
   433  
   434  #### --swift-chunk-size
   435  
   436  Above this size files will be chunked into a _segments container.
   437  
   438  Above this size files will be chunked into a _segments container.  The
   439  default for this is 5GB which is its maximum value.
   440  
   441  - Config:      chunk_size
   442  - Env Var:     RCLONE_SWIFT_CHUNK_SIZE
   443  - Type:        SizeSuffix
   444  - Default:     5G
   445  
   446  #### --swift-no-chunk
   447  
   448  Don't chunk files during streaming upload.
   449  
   450  When doing streaming uploads (eg using rcat or mount) setting this
   451  flag will cause the swift backend to not upload chunked files.
   452  
   453  This will limit the maximum upload size to 5GB. However non chunked
   454  files are easier to deal with and have an MD5SUM.
   455  
   456  Rclone will still chunk files bigger than chunk_size when doing normal
   457  copy operations.
   458  
   459  - Config:      no_chunk
   460  - Env Var:     RCLONE_SWIFT_NO_CHUNK
   461  - Type:        bool
   462  - Default:     false
   463  
   464  #### --swift-encoding
   465  
   466  This sets the encoding for the backend.
   467  
   468  See: the [encoding section in the overview](/overview/#encoding) for more info.
   469  
   470  - Config:      encoding
   471  - Env Var:     RCLONE_SWIFT_ENCODING
   472  - Type:        MultiEncoder
   473  - Default:     Slash,InvalidUtf8
   474  
   475  <!--- autogenerated options stop -->
   476  
   477  ### Modified time ###
   478  
   479  The modified time is stored as metadata on the object as
   480  `X-Object-Meta-Mtime` as floating point since the epoch accurate to 1
   481  ns.
   482  
   483  This is a defacto standard (used in the official python-swiftclient
   484  amongst others) for storing the modification time for an object.
   485  
   486  ### Restricted filename characters
   487  
   488  | Character | Value | Replacement |
   489  | --------- |:-----:|:-----------:|
   490  | NUL       | 0x00  | ␀           |
   491  | /         | 0x2F  | /          |
   492  
   493  Invalid UTF-8 bytes will also be [replaced](/overview/#invalid-utf8),
   494  as they can't be used in JSON strings.
   495  
   496  ### Limitations ###
   497  
   498  The Swift API doesn't return a correct MD5SUM for segmented files
   499  (Dynamic or Static Large Objects) so rclone won't check or use the
   500  MD5SUM for these.
   501  
   502  ### Troubleshooting ###
   503  
   504  #### Rclone gives Failed to create file system for "remote:": Bad Request ####
   505  
   506  Due to an oddity of the underlying swift library, it gives a "Bad
   507  Request" error rather than a more sensible error when the
   508  authentication fails for Swift.
   509  
   510  So this most likely means your username / password is wrong.  You can
   511  investigate further with the `--dump-bodies` flag.
   512  
   513  This may also be caused by specifying the region when you shouldn't
   514  have (eg OVH).
   515  
   516  #### Rclone gives Failed to create file system: Response didn't have storage storage url and auth token ####
   517  
   518  This is most likely caused by forgetting to specify your tenant when
   519  setting up a swift remote.