[Support] Apache WebDAV


Recommended Posts

Overview: Support for my Apache WebDAV container (forked from bytemark)

Docker: https://hub.docker.com/r/apachewebdav/apachewebdav

Github: https://github.com/mgutt/docker-apachewebdav

 

This is a very simple WebDAV server. To upload files you need to use a WebDAV client like Filezilla, Nextcloud, CyberDuck, WinSCP, Nautilus, ... or you could even mount it in Windows. Read the following post to add multiple logins or allow files downloads by guests.

 

Donate? Paypal or Github 🤗

 

 

 

Link to comment

Multi-user setup

 

Specifying USERNAME and PASSWORD only supports a single user. If you want to have lots of different logins for various users, bind mount user.passwd as follows:

  1. Open the Unraid WebTerminal >_ and execute the following:
    mkdir /mnt/user/appdata/apachewebdav && touch /mnt/user/appdata/apachewebdav/user.passwd

     

  2. Edit the container, scroll down and click on image.png.d0656a807ac360825ea8754bdb8352d5.png to add a new Path as follows:
    Container Path: /user.passwd
    Host Path: /mnt/user/appdata/apachewebdav/user.passwd
    Screenshot:
    image.png.5d82266edf79d9919d9badd3615f9823.png

  3. After starting the container, click on the container icon and open its console and execute the following for "Basic" authentification by changing "John" to your username:
    htpasswd -B /user.passwd John

    or this if you choosed "Digest" authentification:

    htdigest user.passwd WebDAV-Login John

    Execute the command multiple times with different usernames to add more users.

 

Access files without login

 

If you like to allow guests (without login) to download files, you can add "GET" as a public method:

image.thumb.png.711df8147a5c1a715304563b5ba272b2.png

 

 

Link to comment

Hi Marc, just what I needed, thank you so much! I was able to get the docker to boot, although it only worked with leaving server name blank (wouldn't take my server's IP). But that's fine. 

 

What I'm having problems with is I think permissions: the WebDAV WebUI (but also when connected through a client) shows no files, but "Container Path: /var/lib/dav" points towards one that is populated with many files and folders. I already ran the Docker Permission tool but that didn't help.

 

Did you run into the same problem by any chance? I'm looking into it now, but wanted to leave this comment here already.

 

Thanks so much again!

 

All the best,

Benedikt

Edited by benediktleb
Link to comment

When I try to start the container it immediately stops after creating the username and privkey.pem with this error:

 

httpd: Syntax error on line 159 of /usr/local/apache2/conf/httpd.conf: Cannot load modules/mod_ssl.so into server: Error relocating /usr/local/apache2/modules/mod_ssl.so: SSL_CTX_set_post_handshake_auth: symbol not found

 

Enable SSL is set to selfsigned

 

I noticed that the image hasn't been updated for over 2 years. Could this lead to security issues?

 

Edit:

@mgutt This image will not work with SSL enabled according to https://github.com/BytemarkHosting/docker-webdav/issues/5.

I'm now using the k3vmcd/webdav fork instead which fixes this problem.

Edited by kennymc.c
Link to comment
  • 3 months later...

Hi Mgutt! Thanks a lot. But I encountered a problem. After I edit a file (for example an Excel file) by opening it through webdav, I can only open the same file with READ ONLY mode when I come back home where my unRaid server is through smb.

Could you please tell me why and how to fix it? Thank you so much!

Link to comment
On 7/7/2021 at 4:09 AM, Tidus said:

Could you please tell me why and how to fix it?

This happens because this container uses different user / group ids for the files than the Unraid defaults. It was a bad decision from me to use this container. The same is valid for @kennymc.c chosen container. I think I will update the template and use this one in the next release:

https://github.com/noodlefighter/docker-webdav

 

He was the last user who posted an udpate (pull request) for bytemark's container:

https://github.com/BytemarkHosting/docker-webdav/pulls

1185521418_2021-07-0919_27_47.png.0c48edbdf78612a32131f9117bf18488.png

 

Link to comment
  • mgutt changed the title to [Support] Apache WebDAV
22 hours ago, mgutt said:

Ok, I found a docker container which uses noodlefighter's last pull request:

https://hub.docker.com/r/shouya/docker-webdav

 

I updated the Unraid template accordingly. It should be online in the Unraid Apps in around 2 hours. It should support SSL certificates and set correct UID and GID for uploaded files.

Thank you so much for your kind effort. I tried just now and the problem has perfectly solved. But it seems there is another problem:

image.png.489530c5a1432304e8cf2128337f3d72.png

I specified the share path for this container as above: /mnt/user/Documents/

When I log in through webdav remotely, I did have access to the webdav server, but it was empty. Then I carefully checked everything and found that it seemed that this container created a new folder (/mnt/user/Documents/data) under Documents where I specified, which means that I can only have access to /mnt/user/Documents/data instead of what I specified (/mnt/user/Documents/)

I'll be so grateful if you may tell me how to fix it. I do need to have access to /mnt/user/Documents/ through webdav.

Thank you so much!

Link to comment
8 minutes ago, Tidus said:

I'll be so grateful if you may tell me how to fix it.

Usually this is not provided, but I solved it by adding two different mounts:

 

image.png.aee52d2d96ffc9cc387357b9d16a14d6.png

 

image.png.81b6f1db3440173cd6a95ac7ca21ccc6.png

 

This means /mnt/user/webdav or in your case /mnt/user/Documents is linked to /var/lib/dav/data and the parent dir /var/lib/dav is linked to /mnt/user/appdata/webdav.

 

But there is still a problem:

If I create a file through SMB in the directory /mnt/user/webdav, it has the correct user "marc" and chmod 666, but if I upload a file through a WebDAV client (Filezilla Pro) which uses the Docker itself, the file has the correct user "nobody", but the chmod is only 644 which disallows "marc" to edit the file:

image.png.efee35ee0b0504fd4cb78108546a1d11.png

 

@ich777

Do you have a hint for me to solve this or is this related to the container's source code?

Link to comment
8 hours ago, mgutt said:

Usually this is not provided, but I solved it by adding two different mounts:

 

image.png.aee52d2d96ffc9cc387357b9d16a14d6.png

 

image.png.81b6f1db3440173cd6a95ac7ca21ccc6.png

 

This means /mnt/user/webdav or in your case /mnt/user/Documents is linked to /var/lib/dav/data and the parent dir /var/lib/dav is linked to /mnt/user/appdata/webdav.

 

But there is still a problem:

If I create a file through SMB in the directory /mnt/user/webdav, it has the correct user "marc" and chmod 666, but if I upload a file through a WebDAV client (Filezilla Pro) which uses the Docker itself, the file has the correct user "nobody", but the chmod is only 644 which disallows "marc" to edit the file:

image.png.efee35ee0b0504fd4cb78108546a1d11.png

 

@ich777

Do you have a hint for me to solve this or is this related to the container's source code?

Thank you sooo much for your kind help!

I've already solved my problem by changing the path, linking /var/lib/dav/data to the dir I needed. But I ignored the other mount "Config" you mentioned aboved. I don't know why but it seemed everything is fine up to now. I have the access to my webDAV and the dir is what I specified (I don't want to have access to all the files in my NAS through this webDAV so I did need to specify the very dir).

I know nothing about coding but everything now is perfect for me.

Thank you once again for your kind help!

Link to comment
34 minutes ago, mgutt said:

As of my experience, this is the usual behavior if the SMB share is set to private?!

You are completely right. :)

I will have to take a look later on an report back.

 

EDIT: One thought about that, can't be a UMASK value implemented in the container or is this value ignored from WebDAV?

Link to comment

@ich777

I've added a path as follows:

image.png.e91b4f604185e93a9036128e661b405d.png

 

I added "umask 000" to the envvars file. I checked it inside the container and it has the correct content:

image.png.336ce99745cfb1ed6f32271d1d142465.png

 

But after deleting and re-uploading a file through Filezilla (WebDAV) it still has 644:

image.png.3ce4ab96326a7312642e409c02b9fff5.png

 

And its the only envvars file in this container 🤷‍♂️

image.png.c92f687252faa2ad361228b5853879ce.png

 

The default umask of the terminal is still 0022 as well:

image.png.f31d05852a3a362653cabd3f71e008ef.png

 

I've tried to set umask through a shell command, but it has no effect:

image.png.03eb8c053789dde10289b235849b04c2.png

 

Test:

image.png.c74b0cdb2e8c81990fa4fb27480b7675.png

 

It seems only be possible through the docker-entrypoint.sh. Is it possible to change / add something to this file without being the container maintainer?

Link to comment
4 minutes ago, mgutt said:

It seems only be possible through the docker-entrypoint.sh. Is it possible to change / add something to this file without being the container maintainer?

No, that is not possible, at least not to make it permanent.

You can edit the file inside the container with nano or vi and test if everthing is working after a container restart and then create a Github issue on the maintainers Github if he can actually implement this to his container.

Link to comment
37 minutes ago, ich777 said:

No, that is not possible

After investigating further, I throught it should be possible by using the --entrypoint flag:

image.png.7102dd0e43e1302ab58b551c320cecc7.png

 

I copied the file and added "chmod +x", but the container directly crashes (after successful start) without any errors in the logs:

image.png.5c7f88832fe8b0f05372bbcbf9c59b13.png

 

Usually it looks like this:

image.png.22ffccd5b6a8d8e08d05b49e0b1611dc.png

 

37 minutes ago, ich777 said:

You can edit the file inside the container with nano or vi and test if everthing is working after a container restart

nano etc was not available. But I was successful by doing this:

sed -i "$ d" /usr/local/bin/docker-entrypoint.sh
echo "umask 0000" >> /usr/local/bin/docker-entrypoint.sh
echo 'exec "$@"' >> /usr/local/bin/docker-entrypoint.sh

 

Now it's correct:

image.png.c3a5c4491014996be841b9f4934b3c07.png

 

Now I tried it by opening a pull request. I hope the user is still active and accepts it.

  • Like 1
Link to comment
15 hours ago, mgutt said:

After investigating further, I throught it should be possible by using the --entrypoint flag:

Yes, but this is a workaround and I don't recommend to do it that way because if the maintainer changes something trivial to his container it could of course break the workaround itself and the function of the container.

 

15 hours ago, mgutt said:

nano etc was not available. But I was successful by doing this:

But you should be able to install it inside the container for testing purpouses as in a normal Linux environment.

 

15 hours ago, mgutt said:

Now I tried it by opening a pull request. I hope the user is still active and accepts it.

I also hope so, I think everyone would benefit from this.

 

Eventually another idea is to put a ENV in the Dockerfile for the UMASK value and then set it in the entrypoint so that if someone needs it he can actually change the value with a variable for the container.

 

Dockerfile:

ENV UMASK=0000

 

Entrypoint:

umask ${UMASK}

 

Link to comment
  • 3 weeks later...

I've recently migrated to Unraid from Synology, and I've been looking for an Unraid equivalent solution to DS FIle on iOS for remote file management. The critical stumbling block was avoiding a download to the iOS device during file copy between shares.

 

I'm not sure how far I am from intended purpose, but I now have it working with this container and the Documents app on iOS.

To achieve my goal I've had to:

1. Disable SSL with the 'Digest' variable, but I only connect via Wireguard tunnel, so I'm assuming this is safe enough.

2. Set the WebDav Share to /mnt/usr/

 

Firstly, if this continues to work as well as I think it does, thank you very much, please keep this container alive! But perhaps more importantly, aside from the risk of my accidental deletion of all shares....can you tell me of any fundemental issues with this approach?

Edited by poobahuk
missing info/typo
Link to comment

As the maintainers bytemark and noodlefighter are not active anymore, I created a new repository and included most of the open pull requests:

https://github.com/mgutt/docker-apachewebdav

https://hub.docker.com/r/apachewebdav/apachewebdav

 

In addition I changed the look of the WebUI by enabling Icons and switching to an HTML table:

image.png.a856866425f99a92270cdc40d3bd49cd.png

 

With more effort it would be possible to realize something similar to this project:

https://github.com/jmlemetayer/abba

image.png.e87b945709a1901950d534bcb2e1f747.png

 

If anyone is interested in this, then let me know.

  • Like 2
  • Upvote 1
Link to comment
  • 2 weeks later...
On 8/11/2021 at 7:14 AM, mgutt said:

As the maintainers bytemark and noodlefighter are not active anymore, I created a new repository and included most of the open pull requests:

https://github.com/mgutt/docker-apachewebdav

https://hub.docker.com/r/apachewebdav/apachewebdav

 

In addition I changed the look of the WebUI by enabling Icons and switching to an HTML table:

...

 

With more effort it would be possible to realize something similar to this project:

https://github.com/jmlemetayer/abba

,,,

 

If anyone is interested in this, then let me know.


This is pretty spectacular. I am not an unraid user but this image is very useful to me (who hosts webdav through docker on my linux server). Thanks for your work in assembling this

  • Like 1
Link to comment
  • 2 months later...

你好,感谢开发出这么好的软件。

我在使用 多用户 的时候,创建了 用户id

但是登陆后提示下面的错误:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

 

求助下,这个问题怎么解决?

Link to comment

你好,感谢开发出这么好的软件。

我在使用 多用户 的时候,创建了 用户id

但是登陆后提示下面的错误:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

 

求助下,这个问题怎么解决?

Link to comment
  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.