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 [2023/01/03 13:56] – new version of the lighttpd doesn't need for the var stokito | docs:guide-user:services:nas:webdav [2024/12/15 13:03] – [ZeroConf autodiscovery] stokito | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== WebDAV Share ====== | ====== WebDAV Share ====== | ||
| - | [[wp> | + | [[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. 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> | ||
| + | opkg update | ||
| + | opkg list-upgradable | cut -f 1 -d ' ' | grep lighttpd | xargs opkg upgrade | ||
| + | </ | ||
| + | |||
| + | Assuming that USB drive is mounted to ''/ | ||
| <code bash> | <code bash> | ||
| - | mkdir -p / | + | mkdir -p / |
| - | chown http: | + | chown http: |
| - | mkdir -p / | + | cat << |
| - | mkdir -p / | + | |
| - | chown http: | + | |
| - | cat << EOF > / | + | |
| $HTTP[" | $HTTP[" | ||
| - | server.document-root := "/srv/ | + | server.document-root := "/mnt/ |
| auth.backend = " | auth.backend = " | ||
| auth.backend.plain.userfile = "/ | auth.backend.plain.userfile = "/ | ||
| Line 21: | Line 27: | ||
| "/ | "/ | ||
| ) | ) | ||
| + | auth.cache = (" | ||
| } | } | ||
| EOF | EOF | ||
| Line 26: | 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: | ||
| Line 34: | Line 40: | ||
| </ | </ | ||
| - | **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: | ||
| <code bash> | <code bash> | ||
| - | < / | + | < / |
| </ | </ | ||
| And finally restart Lighttpd: | And finally restart Lighttpd: | ||
| - | < | + | |
| + | < | ||
| / | / | ||
| </ | </ | ||
| Line 51: | 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 '' |
| - | + | ||
| - | < | + | |
| - | cadaver http:// | + | |
| - | Authentication required for webdav on server `192.168.1.1': | + | |
| - | Username: youruser | + | |
| - | Password: | + | |
| - | dav:/ | + | |
| - | Listing collection `/ | + | |
| - | README.txt | + | |
| - | dav:/ | + | |
| - | Displaying `/ | + | |
| - | It works! | + | |
| - | dav:/ | + | |
| - | Connection to `192.168.1.1' | + | |
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | If you don't want to install the cadaver you can test with a '' | + | |
| <code bash> | <code bash> | ||
| - | curl -u youruser -X PROPFIND -H "Depth: 1" | + | curl -u youruser:pass -X PROPFIND -H 'Depth: 1' http:// |
| </ | </ | ||
| + | You must see a 207 status code and XML response with directory listing. | ||
| - | ==== Don't forget about encryption! ==== | + | See more details and examples [[https:// |
| + | ==== Don't forget about encryption! ==== | ||
| Please note that you must configure HTTPS if you are going to access your files from internet. | Please note that you must configure HTTPS if you are going to access your files from internet. | ||
| - | See [[https:// | + | You'll need to [[docs: |
| ==== Browser UI for the WebDAV share ==== | ==== Browser UI for the WebDAV share ==== | ||
| + | As with usual HTTP you can see (GET) any file directly from a browser but you can't see a listing of files in a folder. That's because for a listing is used a PROPFIND method but not just GET. | ||
| + | But you can install a [[https:// | ||
| - | To watch the share from a browser you can install the small and nice UI | + | But a better is to install the small and nice UI [[https:// |
| - | https:// | + | |
| - | + | ||
| - | Create | + | |
| <code html> | <code html> | ||
| Line 91: | Line 84: | ||
| <html lang=" | <html lang=" | ||
| < | < | ||
| - | | + | <meta charset=" |
| - | < | + | < |
| - | <link rel=" | + | <link rel=" |
| </ | </ | ||
| < | < | ||
| Line 101: | Line 94: | ||
| </ | </ | ||
| - | Then open http:// | + | Then open [[http:// |
| - | The disadvantage of the method is that it's doesn' | + | The disadvantage of the method is that it's doesn' |
| That's fine for 99% of usages. | 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 share to backup data. Some notable apps: | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | 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:// | ||
| + | * [[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 yaml / | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | ] | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | The reload the umdns service with: '' | ||