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

     1  ---
     2  title: "WebDAV"
     3  description: "Rclone docs for WebDAV"
     4  date: "2017-10-01"
     5  ---
     6  
     7  <i class="fa fa-globe"></i> WebDAV
     8  -----------------------------------------
     9  
    10  Paths are specified as `remote:path`
    11  
    12  Paths may be as deep as required, eg `remote:directory/subdirectory`.
    13  
    14  To configure the WebDAV remote you will need to have a URL for it, and
    15  a username and password.  If you know what kind of system you are
    16  connecting to then rclone can enable extra features.
    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 / Webdav
    35     \ "webdav"
    36  [snip]
    37  Storage> webdav
    38  URL of http host to connect to
    39  Choose a number from below, or type in your own value
    40   1 / Connect to example.com
    41     \ "https://example.com"
    42  url> https://example.com/remote.php/webdav/
    43  Name of the Webdav site/service/software you are using
    44  Choose a number from below, or type in your own value
    45   1 / Nextcloud
    46     \ "nextcloud"
    47   2 / Owncloud
    48     \ "owncloud"
    49   3 / Sharepoint
    50     \ "sharepoint"
    51   4 / Other site/service or software
    52     \ "other"
    53  vendor> 1
    54  User name
    55  user> user
    56  Password.
    57  y) Yes type in my own password
    58  g) Generate random password
    59  n) No leave this optional password blank
    60  y/g/n> y
    61  Enter the password:
    62  password:
    63  Confirm the password:
    64  password:
    65  Bearer token instead of user/pass (eg a Macaroon)
    66  bearer_token>
    67  Remote config
    68  --------------------
    69  [remote]
    70  type = webdav
    71  url = https://example.com/remote.php/webdav/
    72  vendor = nextcloud
    73  user = user
    74  pass = *** ENCRYPTED ***
    75  bearer_token =
    76  --------------------
    77  y) Yes this is OK
    78  e) Edit this remote
    79  d) Delete this remote
    80  y/e/d> y
    81  ```
    82  
    83  Once configured you can then use `rclone` like this,
    84  
    85  List directories in top level of your WebDAV
    86  
    87      rclone lsd remote:
    88  
    89  List all the files in your WebDAV
    90  
    91      rclone ls remote:
    92  
    93  To copy a local directory to an WebDAV directory called backup
    94  
    95      rclone copy /home/source remote:backup
    96  
    97  ### Modified time and hashes ###
    98  
    99  Plain WebDAV does not support modified times.  However when used with
   100  Owncloud or Nextcloud rclone will support modified times.
   101  
   102  Likewise plain WebDAV does not support hashes, however when used with
   103  Owncloud or Nextcloud rclone will support SHA1 and MD5 hashes.
   104  Depending on the exact version of Owncloud or Nextcloud hashes may
   105  appear on all objects, or only on objects which had a hash uploaded
   106  with them.
   107  
   108  <!--- autogenerated options start - DO NOT EDIT, instead edit fs.RegInfo in backend/webdav/webdav.go then run make backenddocs -->
   109  ### Standard Options
   110  
   111  Here are the standard options specific to webdav (Webdav).
   112  
   113  #### --webdav-url
   114  
   115  URL of http host to connect to
   116  
   117  - Config:      url
   118  - Env Var:     RCLONE_WEBDAV_URL
   119  - Type:        string
   120  - Default:     ""
   121  - Examples:
   122      - "https://example.com"
   123          - Connect to example.com
   124  
   125  #### --webdav-vendor
   126  
   127  Name of the Webdav site/service/software you are using
   128  
   129  - Config:      vendor
   130  - Env Var:     RCLONE_WEBDAV_VENDOR
   131  - Type:        string
   132  - Default:     ""
   133  - Examples:
   134      - "nextcloud"
   135          - Nextcloud
   136      - "owncloud"
   137          - Owncloud
   138      - "sharepoint"
   139          - Sharepoint
   140      - "other"
   141          - Other site/service or software
   142  
   143  #### --webdav-user
   144  
   145  User name
   146  
   147  - Config:      user
   148  - Env Var:     RCLONE_WEBDAV_USER
   149  - Type:        string
   150  - Default:     ""
   151  
   152  #### --webdav-pass
   153  
   154  Password.
   155  
   156  - Config:      pass
   157  - Env Var:     RCLONE_WEBDAV_PASS
   158  - Type:        string
   159  - Default:     ""
   160  
   161  #### --webdav-bearer-token
   162  
   163  Bearer token instead of user/pass (eg a Macaroon)
   164  
   165  - Config:      bearer_token
   166  - Env Var:     RCLONE_WEBDAV_BEARER_TOKEN
   167  - Type:        string
   168  - Default:     ""
   169  
   170  ### Advanced Options
   171  
   172  Here are the advanced options specific to webdav (Webdav).
   173  
   174  #### --webdav-bearer-token-command
   175  
   176  Command to run to get a bearer token
   177  
   178  - Config:      bearer_token_command
   179  - Env Var:     RCLONE_WEBDAV_BEARER_TOKEN_COMMAND
   180  - Type:        string
   181  - Default:     ""
   182  
   183  <!--- autogenerated options stop -->
   184  
   185  ## Provider notes ##
   186  
   187  See below for notes on specific providers.
   188  
   189  ### Owncloud ###
   190  
   191  Click on the settings cog in the bottom right of the page and this
   192  will show the WebDAV URL that rclone needs in the config step.  It
   193  will look something like `https://example.com/remote.php/webdav/`.
   194  
   195  Owncloud supports modified times using the `X-OC-Mtime` header.
   196  
   197  ### Nextcloud ###
   198  
   199  This is configured in an identical way to Owncloud.  Note that
   200  Nextcloud does not support streaming of files (`rcat`) whereas
   201  Owncloud does. This [may be
   202  fixed](https://github.com/nextcloud/nextcloud-snap/issues/365) in the
   203  future.
   204  
   205  ### Sharepoint ###
   206  
   207  Rclone can be used with Sharepoint provided by OneDrive for Business
   208  or Office365 Education Accounts.
   209  This feature is only needed for a few of these Accounts,
   210  mostly Office365 Education ones. These accounts are sometimes not
   211  verified by the domain owner [github#1975](https://github.com/rclone/rclone/issues/1975)
   212  
   213  This means that these accounts can't be added using the official
   214  API (other Accounts should work with the "onedrive" option). However,
   215  it is possible to access them using webdav.
   216  
   217  To use a sharepoint remote with rclone, add it like this:
   218  First, you need to get your remote's URL:
   219  
   220  - Go [here](https://onedrive.live.com/about/en-us/signin/)
   221    to open your OneDrive or to sign in
   222  - Now take a look at your address bar, the URL should look like this:
   223    `https://[YOUR-DOMAIN]-my.sharepoint.com/personal/[YOUR-EMAIL]/_layouts/15/onedrive.aspx`
   224  
   225  You'll only need this URL upto the email address. After that, you'll
   226  most likely want to add "/Documents". That subdirectory contains
   227  the actual data stored on your OneDrive.
   228  
   229  Add the remote to rclone like this:
   230  Configure the `url` as `https://[YOUR-DOMAIN]-my.sharepoint.com/personal/[YOUR-EMAIL]/Documents`
   231  and use your normal account email and password for `user` and `pass`.
   232  If you have 2FA enabled, you have to generate an app password.
   233  Set the `vendor` to `sharepoint`.
   234  
   235  Your config file should look like this:
   236  
   237  ```
   238  [sharepoint]
   239  type = webdav
   240  url = https://[YOUR-DOMAIN]-my.sharepoint.com/personal/[YOUR-EMAIL]/Documents
   241  vendor = other
   242  user = YourEmailAddress
   243  pass = encryptedpassword
   244  ```
   245  
   246  #### Required Flags for SharePoint ####
   247  As SharePoint does some special things with uploaded documents, you won't be able to use the documents size or the documents hash to compare if a file has been changed since the upload / which file is newer.
   248  
   249  For Rclone calls copying files (especially Office files such as .docx, .xlsx, etc.) from/to SharePoint (like copy, sync, etc.), you should append these flags to ensure Rclone uses the "Last Modified" datetime property to compare your documents:
   250  
   251  ```
   252  --ignore-size --ignore-checksum --update
   253  ```
   254  
   255  ### dCache ###
   256  
   257  dCache is a storage system that supports many protocols and
   258  authentication/authorisation schemes.  For WebDAV clients, it allows
   259  users to authenticate with username and password (BASIC), X.509,
   260  Kerberos, and various bearer tokens, including
   261  [Macaroons](https://www.dcache.org/manuals/workshop-2017-05-29-Umea/000-Final/anupam_macaroons_v02.pdf)
   262  and [OpenID-Connect](https://en.wikipedia.org/wiki/OpenID_Connect)
   263  access tokens.
   264  
   265  Configure as normal using the `other` type.  Don't enter a username or
   266  password, instead enter your Macaroon as the `bearer_token`.
   267  
   268  The config will end up looking something like this.
   269  
   270  ```
   271  [dcache]
   272  type = webdav
   273  url = https://dcache...
   274  vendor = other
   275  user =
   276  pass =
   277  bearer_token = your-macaroon
   278  ```
   279  
   280  There is a [script](https://github.com/sara-nl/GridScripts/blob/master/get-macaroon) that
   281  obtains a Macaroon from a dCache WebDAV endpoint, and creates an rclone config file.
   282  
   283  Macaroons may also be obtained from the dCacheView
   284  web-browser/JavaScript client that comes with dCache.
   285  
   286  ### OpenID-Connect ###
   287  
   288  dCache also supports authenticating with OpenID-Connect access tokens.
   289  OpenID-Connect is a protocol (based on OAuth 2.0) that allows services
   290  to identify users who have authenticated with some central service.
   291  
   292  Support for OpenID-Connect in rclone is currently achieved using
   293  another software package called
   294  [oidc-agent](https://github.com/indigo-dc/oidc-agent).  This is a
   295  command-line tool that facilitates obtaining an access token.  Once
   296  installed and configured, an access token is obtained by running the
   297  `oidc-token` command.  The following example shows a (shortened)
   298  access token obtained from the *XDC* OIDC Provider.
   299  
   300  ```
   301  paul@celebrimbor:~$ oidc-token XDC
   302  eyJraWQ[...]QFXDt0
   303  paul@celebrimbor:~$
   304  ```
   305  
   306  **Note** Before the `oidc-token` command will work, the refresh token
   307  must be loaded into the oidc agent.  This is done with the `oidc-add`
   308  command (e.g., `oidc-add XDC`).  This is typically done once per login
   309  session.  Full details on this and how to register oidc-agent with
   310  your OIDC Provider are provided in the [oidc-agent
   311  documentation](https://indigo-dc.gitbooks.io/oidc-agent/).
   312  
   313  The rclone `bearer_token_command` configuration option is used to
   314  fetch the access token from oidc-agent.
   315  
   316  Configure as a normal WebDAV endpoint, using the 'other' vendor,
   317  leaving the username and password empty.  When prompted, choose to
   318  edit the advanced config and enter the command to get a bearer token
   319  (e.g., `oidc-agent XDC`).
   320  
   321  The following example config shows a WebDAV endpoint that uses
   322  oidc-agent to supply an access token from the *XDC* OIDC Provider.
   323  
   324  ```
   325  [dcache]
   326  type = webdav
   327  url = https://dcache.example.org/
   328  vendor = other
   329  bearer_token_command = oidc-token XDC
   330  ```