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

     1  ---
     2  title: "rclone serve webdav"
     3  description: "Serve remote:path over webdav."
     4  slug: rclone_serve_webdav
     5  url: /commands/rclone_serve_webdav/
     6  # autogenerated - DO NOT EDIT, instead edit the source code in cmd/serve/webdav/ and as part of making a release run "make commanddocs"
     7  ---
     8  # rclone serve webdav
     9  
    10  Serve remote:path over webdav.
    11  
    12  ## Synopsis
    13  
    14  
    15  rclone serve webdav implements a basic webdav server to serve the
    16  remote over HTTP via the webdav protocol. This can be viewed with a
    17  webdav client, through a web browser, or you can make a remote of
    18  type webdav to read and write it.
    19  
    20  ## Webdav options
    21  
    22  ### --etag-hash 
    23  
    24  This controls the ETag header.  Without this flag the ETag will be
    25  based on the ModTime and Size of the object.
    26  
    27  If this flag is set to "auto" then rclone will choose the first
    28  supported hash on the backend or you can use a named hash such as
    29  "MD5" or "SHA-1".
    30  
    31  Use "rclone hashsum" to see the full list.
    32  
    33  
    34  ## Server options
    35  
    36  Use --addr to specify which IP address and port the server should
    37  listen on, eg --addr 1.2.3.4:8000 or --addr :8080 to listen to all
    38  IPs.  By default it only listens on localhost.  You can use port
    39  :0 to let the OS choose an available port.
    40  
    41  If you set --addr to listen on a public or LAN accessible IP address
    42  then using Authentication is advised - see the next section for info.
    43  
    44  --server-read-timeout and --server-write-timeout can be used to
    45  control the timeouts on the server.  Note that this is the total time
    46  for a transfer.
    47  
    48  --max-header-bytes controls the maximum number of bytes the server will
    49  accept in the HTTP header.
    50  
    51  --baseurl controls the URL prefix that rclone serves from.  By default
    52  rclone will serve from the root.  If you used --baseurl "/rclone" then
    53  rclone would serve from a URL starting with "/rclone/".  This is
    54  useful if you wish to proxy rclone serve.  Rclone automatically
    55  inserts leading and trailing "/" on --baseurl, so --baseurl "rclone",
    56  --baseurl "/rclone" and --baseurl "/rclone/" are all treated
    57  identically.
    58  
    59  --template allows a user to specify a custom markup template for http
    60  and webdav serve functions.  The server exports the following markup
    61  to be used within the template to server pages:
    62  
    63  | Parameter   | Description |
    64  | :---------- | :---------- |
    65  | .Name       | The full path of a file/directory. |
    66  | .Title      | Directory listing of .Name |
    67  | .Sort       | The current sort used.  This is changeable via ?sort= parameter |
    68  |             | Sort Options: namedirfist,name,size,time (default namedirfirst) |
    69  | .Order      | The current ordering used.  This is changeable via ?order= parameter |
    70  |             | Order Options: asc,desc (default asc) |
    71  | .Query      | Currently unused. |
    72  | .Breadcrumb | Allows for creating a relative navigation |
    73  |-- .Link     | The relative to the root link of the Text. |
    74  |-- .Text     | The Name of the directory. |
    75  | .Entries    | Information about a specific file/directory. |
    76  |-- .URL      | The 'url' of an entry.  |
    77  |-- .Leaf     | Currently same as 'URL' but intended to be 'just' the name. |
    78  |-- .IsDir    | Boolean for if an entry is a directory or not. |
    79  |-- .Size     | Size in Bytes of the entry. |
    80  |-- .ModTime  | The UTC timestamp of an entry. |
    81  
    82  ### Authentication
    83  
    84  By default this will serve files without needing a login.
    85  
    86  You can either use an htpasswd file which can take lots of users, or
    87  set a single username and password with the --user and --pass flags.
    88  
    89  Use --htpasswd /path/to/htpasswd to provide an htpasswd file.  This is
    90  in standard apache format and supports MD5, SHA1 and BCrypt for basic
    91  authentication.  Bcrypt is recommended.
    92  
    93  To create an htpasswd file:
    94  
    95      touch htpasswd
    96      htpasswd -B htpasswd user
    97      htpasswd -B htpasswd anotherUser
    98  
    99  The password file can be updated while rclone is running.
   100  
   101  Use --realm to set the authentication realm.
   102  
   103  ### SSL/TLS
   104  
   105  By default this will serve over http.  If you want you can serve over
   106  https.  You will need to supply the --cert and --key flags.  If you
   107  wish to do client side certificate validation then you will need to
   108  supply --client-ca also.
   109  
   110  --cert should be either a PEM encoded certificate or a concatenation
   111  of that with the CA certificate.  --key should be the PEM encoded
   112  private key and --client-ca should be the PEM encoded client
   113  certificate authority certificate.
   114  
   115  ## Directory Cache
   116  
   117  Using the `--dir-cache-time` flag, you can set how long a
   118  directory should be considered up to date and not refreshed from the
   119  backend. Changes made locally in the mount may appear immediately or
   120  invalidate the cache. However, changes done on the remote will only
   121  be picked up once the cache expires if the backend configured does not
   122  support polling for changes. If the backend supports polling, changes
   123  will be picked up on within the polling interval.
   124  
   125  Alternatively, you can send a `SIGHUP` signal to rclone for
   126  it to flush all directory caches, regardless of how old they are.
   127  Assuming only one rclone instance is running, you can reset the cache
   128  like this:
   129  
   130      kill -SIGHUP $(pidof rclone)
   131  
   132  If you configure rclone with a [remote control](/rc) then you can use
   133  rclone rc to flush the whole directory cache:
   134  
   135      rclone rc vfs/forget
   136  
   137  Or individual files or directories:
   138  
   139      rclone rc vfs/forget file=path/to/file dir=path/to/dir
   140  
   141  ## File Buffering
   142  
   143  The `--buffer-size` flag determines the amount of memory,
   144  that will be used to buffer data in advance.
   145  
   146  Each open file descriptor will try to keep the specified amount of
   147  data in memory at all times. The buffered data is bound to one file
   148  descriptor and won't be shared between multiple open file descriptors
   149  of the same file.
   150  
   151  This flag is a upper limit for the used memory per file descriptor.
   152  The buffer will only use memory for data that is downloaded but not
   153  not yet read. If the buffer is empty, only a small amount of memory
   154  will be used.
   155  The maximum memory used by rclone for buffering can be up to
   156  `--buffer-size * open files`.
   157  
   158  ## File Caching
   159  
   160  These flags control the VFS file caching options.  The VFS layer is
   161  used by rclone mount to make a cloud storage system work more like a
   162  normal file system.
   163  
   164  You'll need to enable VFS caching if you want, for example, to read
   165  and write simultaneously to a file.  See below for more details.
   166  
   167  Note that the VFS cache works in addition to the cache backend and you
   168  may find that you need one or the other or both.
   169  
   170      --cache-dir string                   Directory rclone will use for caching.
   171      --vfs-cache-max-age duration         Max age of objects in the cache. (default 1h0m0s)
   172      --vfs-cache-mode string              Cache mode off|minimal|writes|full (default "off")
   173      --vfs-cache-poll-interval duration   Interval to poll the cache for stale objects. (default 1m0s)
   174      --vfs-cache-max-size int             Max total size of objects in the cache. (default off)
   175  
   176  If run with `-vv` rclone will print the location of the file cache.  The
   177  files are stored in the user cache file area which is OS dependent but
   178  can be controlled with `--cache-dir` or setting the appropriate
   179  environment variable.
   180  
   181  The cache has 4 different modes selected by `--vfs-cache-mode`.
   182  The higher the cache mode the more compatible rclone becomes at the
   183  cost of using disk space.
   184  
   185  Note that files are written back to the remote only when they are
   186  closed so if rclone is quit or dies with open files then these won't
   187  get written back to the remote.  However they will still be in the on
   188  disk cache.
   189  
   190  If using --vfs-cache-max-size note that the cache may exceed this size
   191  for two reasons.  Firstly because it is only checked every
   192  --vfs-cache-poll-interval.  Secondly because open files cannot be
   193  evicted from the cache.
   194  
   195  ### --vfs-cache-mode off
   196  
   197  In this mode the cache will read directly from the remote and write
   198  directly to the remote without caching anything on disk.
   199  
   200  This will mean some operations are not possible
   201  
   202    * Files can't be opened for both read AND write
   203    * Files opened for write can't be seeked
   204    * Existing files opened for write must have O_TRUNC set
   205    * Files open for read with O_TRUNC will be opened write only
   206    * Files open for write only will behave as if O_TRUNC was supplied
   207    * Open modes O_APPEND, O_TRUNC are ignored
   208    * If an upload fails it can't be retried
   209  
   210  ### --vfs-cache-mode minimal
   211  
   212  This is very similar to "off" except that files opened for read AND
   213  write will be buffered to disks.  This means that files opened for
   214  write will be a lot more compatible, but uses the minimal disk space.
   215  
   216  These operations are not possible
   217  
   218    * Files opened for write only can't be seeked
   219    * Existing files opened for write must have O_TRUNC set
   220    * Files opened for write only will ignore O_APPEND, O_TRUNC
   221    * If an upload fails it can't be retried
   222  
   223  ### --vfs-cache-mode writes
   224  
   225  In this mode files opened for read only are still read directly from
   226  the remote, write only and read/write files are buffered to disk
   227  first.
   228  
   229  This mode should support all normal file system operations.
   230  
   231  If an upload fails it will be retried up to --low-level-retries times.
   232  
   233  ### --vfs-cache-mode full
   234  
   235  In this mode all reads and writes are buffered to and from disk.  When
   236  a file is opened for read it will be downloaded in its entirety first.
   237  
   238  This may be appropriate for your needs, or you may prefer to look at
   239  the cache backend which does a much more sophisticated job of caching,
   240  including caching directory hierarchies and chunks of files.
   241  
   242  In this mode, unlike the others, when a file is written to the disk,
   243  it will be kept on the disk after it is written to the remote.  It
   244  will be purged on a schedule according to `--vfs-cache-max-age`.
   245  
   246  This mode should support all normal file system operations.
   247  
   248  If an upload or download fails it will be retried up to
   249  --low-level-retries times.
   250  
   251  ## Case Sensitivity
   252  
   253  Linux file systems are case-sensitive: two files can differ only
   254  by case, and the exact case must be used when opening a file.
   255  
   256  Windows is not like most other operating systems supported by rclone.
   257  File systems in modern Windows are case-insensitive but case-preserving:
   258  although existing files can be opened using any case, the exact case used
   259  to create the file is preserved and available for programs to query.
   260  It is not allowed for two files in the same directory to differ only by case.
   261  
   262  Usually file systems on macOS are case-insensitive. It is possible to make macOS
   263  file systems case-sensitive but that is not the default
   264  
   265  The "--vfs-case-insensitive" mount flag controls how rclone handles these
   266  two cases. If its value is "false", rclone passes file names to the mounted
   267  file system as is. If the flag is "true" (or appears without a value on
   268  command line), rclone may perform a "fixup" as explained below.
   269  
   270  The user may specify a file name to open/delete/rename/etc with a case
   271  different than what is stored on mounted file system. If an argument refers
   272  to an existing file with exactly the same name, then the case of the existing
   273  file on the disk will be used. However, if a file name with exactly the same
   274  name is not found but a name differing only by case exists, rclone will
   275  transparently fixup the name. This fixup happens only when an existing file
   276  is requested. Case sensitivity of file names created anew by rclone is
   277  controlled by an underlying mounted file system.
   278  
   279  Note that case sensitivity of the operating system running rclone (the target)
   280  may differ from case sensitivity of a file system mounted by rclone (the source).
   281  The flag controls whether "fixup" is performed to satisfy the target.
   282  
   283  If the flag is not provided on command line, then its default value depends
   284  on the operating system where rclone runs: "true" on Windows and macOS, "false"
   285  otherwise. If the flag is provided without a value, then it is "true".
   286  
   287  ## Auth Proxy
   288  
   289  If you supply the parameter `--auth-proxy /path/to/program` then
   290  rclone will use that program to generate backends on the fly which
   291  then are used to authenticate incoming requests.  This uses a simple
   292  JSON based protocl with input on STDIN and output on STDOUT.
   293  
   294  **PLEASE NOTE:** `--auth-proxy` and `--authorized-keys` cannot be used
   295  together, if `--auth-proxy` is set the authorized keys option will be
   296  ignored.
   297  
   298  There is an example program
   299  [bin/test_proxy.py](https://github.com/rclone/rclone/blob/master/test_proxy.py)
   300  in the rclone source code.
   301  
   302  The program's job is to take a `user` and `pass` on the input and turn
   303  those into the config for a backend on STDOUT in JSON format.  This
   304  config will have any default parameters for the backend added, but it
   305  won't use configuration from environment variables or command line
   306  options - it is the job of the proxy program to make a complete
   307  config.
   308  
   309  This config generated must have this extra parameter
   310  - `_root` - root to use for the backend
   311  
   312  And it may have this parameter
   313  - `_obscure` - comma separated strings for parameters to obscure
   314  
   315  If password authentication was used by the client, input to the proxy
   316  process (on STDIN) would look similar to this:
   317  
   318  ```
   319  {
   320  	"user": "me",
   321  	"pass": "mypassword"
   322  }
   323  ```
   324  
   325  If public-key authentication was used by the client, input to the
   326  proxy process (on STDIN) would look similar to this:
   327  
   328  ```
   329  {
   330  	"user": "me",
   331  	"public_key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDuwESFdAe14hVS6omeyX7edc...JQdf"
   332  }
   333  ```
   334  
   335  And as an example return this on STDOUT
   336  
   337  ```
   338  {
   339  	"type": "sftp",
   340  	"_root": "",
   341  	"_obscure": "pass",
   342  	"user": "me",
   343  	"pass": "mypassword",
   344  	"host": "sftp.example.com"
   345  }
   346  ```
   347  
   348  This would mean that an SFTP backend would be created on the fly for
   349  the `user` and `pass`/`public_key` returned in the output to the host given.  Note
   350  that since `_obscure` is set to `pass`, rclone will obscure the `pass`
   351  parameter before creating the backend (which is required for sftp
   352  backends).
   353  
   354  The program can manipulate the supplied `user` in any way, for example
   355  to make proxy to many different sftp backends, you could make the
   356  `user` be `user@example.com` and then set the `host` to `example.com`
   357  in the output and the user to `user`. For security you'd probably want
   358  to restrict the `host` to a limited list.
   359  
   360  Note that an internal cache is keyed on `user` so only use that for
   361  configuration, don't use `pass` or `public_key`.  This also means that if a user's
   362  password or public-key is changed the cache will need to expire (which takes 5 mins)
   363  before it takes effect.
   364  
   365  This can be used to build general purpose proxies to any kind of
   366  backend that rclone supports.  
   367  
   368  
   369  ```
   370  rclone serve webdav remote:path [flags]
   371  ```
   372  
   373  ## Options
   374  
   375  ```
   376        --addr string                            IPaddress:Port or :Port to bind server to. (default "localhost:8080")
   377        --auth-proxy string                      A program to use to create the backend from the auth.
   378        --baseurl string                         Prefix for URLs - leave blank for root.
   379        --cert string                            SSL PEM key (concatenation of certificate and CA certificate)
   380        --client-ca string                       Client certificate authority to verify clients with
   381        --dir-cache-time duration                Time to cache directory entries for. (default 5m0s)
   382        --dir-perms FileMode                     Directory permissions (default 0777)
   383        --disable-dir-list                       Disable HTML directory list on GET request for a directory
   384        --etag-hash string                       Which hash to use for the ETag, or auto or blank for off
   385        --file-perms FileMode                    File permissions (default 0666)
   386        --gid uint32                             Override the gid field set by the filesystem. (default 1000)
   387    -h, --help                                   help for webdav
   388        --htpasswd string                        htpasswd file - if not provided no authentication is done
   389        --key string                             SSL PEM Private key
   390        --max-header-bytes int                   Maximum size of request header (default 4096)
   391        --no-checksum                            Don't compare checksums on up/download.
   392        --no-modtime                             Don't read/write the modification time (can speed things up).
   393        --no-seek                                Don't allow seeking in files.
   394        --pass string                            Password for authentication.
   395        --poll-interval duration                 Time to wait between polling for changes. Must be smaller than dir-cache-time. Only on supported remotes. Set to 0 to disable. (default 1m0s)
   396        --read-only                              Mount read-only.
   397        --realm string                           realm for authentication (default "rclone")
   398        --server-read-timeout duration           Timeout for server reading data (default 1h0m0s)
   399        --server-write-timeout duration          Timeout for server writing data (default 1h0m0s)
   400        --template string                        User Specified Template.
   401        --uid uint32                             Override the uid field set by the filesystem. (default 1000)
   402        --umask int                              Override the permission bits set by the filesystem. (default 2)
   403        --user string                            User name for authentication.
   404        --vfs-cache-max-age duration             Max age of objects in the cache. (default 1h0m0s)
   405        --vfs-cache-max-size SizeSuffix          Max total size of objects in the cache. (default off)
   406        --vfs-cache-mode CacheMode               Cache mode off|minimal|writes|full (default off)
   407        --vfs-cache-poll-interval duration       Interval to poll the cache for stale objects. (default 1m0s)
   408        --vfs-case-insensitive                   If a file name not found, find a case insensitive match.
   409        --vfs-read-chunk-size SizeSuffix         Read the source objects in chunks. (default 128M)
   410        --vfs-read-chunk-size-limit SizeSuffix   If greater than --vfs-read-chunk-size, double the chunk size after each chunk read, until the limit is reached. 'off' is unlimited. (default off)
   411        --vfs-read-wait duration                 Time to wait for in-sequence read before seeking. (default 20ms)
   412        --vfs-write-wait duration                Time to wait for in-sequence write before giving error. (default 1s)
   413  ```
   414  
   415  See the [global flags page](/flags/) for global options not listed here.
   416  
   417  ## SEE ALSO
   418  
   419  * [rclone serve](/commands/rclone_serve/)	 - Serve a remote over a protocol.
   420