Skip to main content

Deploy WebDAV server

JuiceFS Cloud Service client provides a juicefs webdav subcommand since version 4.9, which can be used to configure a file system as a WebDAV file sharing server.

Before deploying the WebDAV server, you need to authenticate against the Web Console using the auth command, this command will fetch the configuration file.

Deploy a WebDAV server

Set username and password via environment variables:

export WEBDAV_USER=root
export WEBDAV_PASSWORD=1234

Start the WebDAV server:

juicefs webdav myjfs localhost:9007

When the server starts successfully, you can access the file system via a WebDAV client.

To stop the server, press Ctrl + C.

Encrypted WebDAV server

The WebDAV server uses HTTP protocol by default. If you want to use HTTPS protocol, you can specify the certificate and private key files via --cert-file and --key-file options.

Here is an example of a self-signed certificate, which is first generated:

# Generate private key
openssl genrsa -out client.key 4096
# Generate certificate signing request
openssl req -new -key client.key -out client.csr
# Generate self-signed certificate
openssl x509 -req -days 365 -in client.csr -signkey client.key -out client.crt

Then, use the certificate and private key to start the WebDAV server:

# Set username and password
export WEBDAV_USER=root
export WEBDAV_PASSWORD=1234
# Start WebDAV server
juicefs webdav --cert-file client.crt --key-file client.key myjfs localhost:9007

You should replace the protocal with https:// and the server address with localhost:9007 in the WebDAV client.

Anonymous WebDAV server

caution

Anonymous WebDAV server is not recommended for production use. It is only for testing and demo.

You can start an anonymous WebDAV server without username and password:

juicefs webdav myjfs localhost:9007