Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:services:nas:webdav [2022/05/13 01:00] – [WebDAV Share] stokito | docs:guide-user:services:nas:webdav [2023/03/18 20:24] – [Test it] removed cadaver stokito | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== WebDAV Share ====== | ====== WebDAV Share ====== | ||
| - | WebDAV is an HTTP based file transfer protocol. It's integrated into Windows, GNOME, KDE and many programs for backups, file sharing and media players. | + | [[wp> |
| - | + | It's integrated into Windows, GNOME, KDE and many programs for backups, file sharing and media players. | |
| - | It's installed as a plugin for a web server. But unfortunately OpenWrt' | + | |
| + | It's installed as a plugin for a web server. | ||
| + | Unfortunately OpenWrt' | ||
| + | If you have enough space you can install [[docs: | ||
| ==== WebDAV with Lighttpd ==== | ==== WebDAV with Lighttpd ==== | ||
| - | Assuming that USB drive is mounted to ''/ | + | First of all if you already have the Lighttpd then update it and it's modules to avoid conflicts: |
| - | < | + | <code bash> |
| - | mkdir -p / | + | opkg update |
| - | chown http: | + | opkg list-upgradable | cut -f 1 -d ' ' | grep lighttpd | xargs opkg upgrade |
| - | mkdir -p / | + | </ |
| - | mkdir -p / | + | |
| - | chown http: | + | Assuming that USB drive is mounted to ''/ |
| - | echo " | + | |
| - | cat << EOF > / | + | < |
| + | mkdir -p / | ||
| + | chown http: | ||
| + | cat << | ||
| $HTTP[" | $HTTP[" | ||
| - | server.document-root := "/srv/ | + | server.document-root := "/mnt/ |
| auth.backend = " | auth.backend = " | ||
| auth.backend.plain.userfile = "/ | auth.backend.plain.userfile = "/ | ||
| - | auth.require = ("" | + | auth.require = ( |
| + | | ||
| + | ) | ||
| + | auth.cache = (" | ||
| } | } | ||
| EOF | EOF | ||
| Line 25: | Line 33: | ||
| opkg install lighttpd-mod-auth lighttpd-mod-authn_file lighttpd-mod-webdav | opkg install lighttpd-mod-auth lighttpd-mod-authn_file lighttpd-mod-webdav | ||
| </ | </ | ||
| - | |||
| Now set a password: | Now set a password: | ||
| - | < | + | < |
| echo " | echo " | ||
| </ | </ | ||
| - | Note: your secret is not encoded and saved on router in clear text for a better performance. If a hacker get access to the file it can see your password. So don't put here a password that you are using anywhere else. Just generate a new one for example with the command: | ||
| - | < | + | **Note:** your secret is not encoded and saved on router in clear text for a better performance. |
| - | < / | + | If a hacker get access to the file it can see your password. |
| + | So don't put here a password that you are using anywhere else. | ||
| + | Just generate a new one for example with the command: | ||
| + | |||
| + | < | ||
| + | < / | ||
| </ | </ | ||
| And finally restart Lighttpd: | And finally restart Lighttpd: | ||
| - | < | + | |
| + | < | ||
| / | / | ||
| </ | </ | ||
| Line 49: | Line 61: | ||
| To connect to WebDAV see [[https:// | To connect to WebDAV see [[https:// | ||
| - | To test WebDAV from command line use '' | + | A quick test can be done with a '' |
| - | < | + | < |
| - | | + | curl -u youruser:pass -X PROPFIND -H 'Depth: 1' |
| - | Authentication required for webdav on server `192.168.1.1': | + | |
| - | Username: | + | |
| - | Password: | + | |
| - | dav:/ | + | |
| - | Listing collection `/dav/': | + | |
| - | README.txt | + | |
| - | dav:/ | + | |
| - | Displaying `/ | + | |
| - | It works! | + | |
| - | dav:/dav/> exit | + | |
| - | Connection to `192.168.1.1' closed. | + | |
| </ | </ | ||
| + | You must see a 207 status code and XML response with directory listing. | ||
| + | See more details and examples [[https:// | ||
| - | If you don' | + | ==== Don' |
| + | Please note that you must configure HTTPS if you are going to access your files from internet. | ||
| + | You'll need to [[docs: | ||
| - | < | + | ==== Browser UI for the WebDAV share ==== |
| - | curl -u youruser | + | To watch the share from a browser you can install the small and nice UI [[https:// |
| + | |||
| + | < | ||
| + | cat << EOF > / | ||
| + | < | ||
| + | <html lang=" | ||
| + | < | ||
| + | <meta charset=" | ||
| + | < | ||
| + | <link rel=" | ||
| + | </ | ||
| + | < | ||
| + | <script src="https://cdn.jsdelivr.net/ | ||
| + | </body> | ||
| + | </ | ||
| + | EOF | ||
| </ | </ | ||
| - | ==== UI for the WebDAV share ==== | + | Then open [[http:// |
| - | To watch the share from a browser | + | |
| - | https:// | + | The disadvantage of the method is that it's doesn' |
| + | That's fine for 99% of usages. | ||
| + | |||
| + | == Online apps and PWAs == | ||
| + | You can also try an online apps that can connect directly to your WebDAV | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https://app.keeweb.info/ | ||
| + | |||
| + | To allow online apps to connect with your WebDAV it need a CORS enabled. | ||
| + | Here is an example [[https:// | ||
| + | |||
| + | == Useful Apps == | ||
| + | Useful mobile apps that supports WebDAV sync: | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| ==== Links and docs ==== | ==== Links and docs ==== | ||
| - | * https:// | + | * [[https:// |
| - | * https:// | + | * [[https:// |
| - | * https:// | + | * [[https:// |
| - | * https:// | + | * [[https:// |
| * [[https:// | * [[https:// | ||
| + | ==== ZeroConf autodiscovery ==== | ||
| + | You can advertise a WebDAV share with [[docs: | ||
| + | Then it will be seen in Network folder of a file manager in GNOME and KDE and can be [[https:// | ||
| + | |||
| + | Install the umdns package with '' | ||
| + | |||
| + | <code - / | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | ] | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | The reload the umdns service with: '' | ||