Build a simple WebDAV server on Linux
Introduction
I started thinking that I wish I could set up a file server more easily and quickly during the contest. The goal is an environment that can be quickly accessed by a client like WinSCP, and file transfer and file opening can be done easily.
The process leading up to WebDAV
There are various types of file servers, but I would like to explain a few candidates that came to my mind.
- What about SFTP?
If you mess with the SSH server and break it, you will not be able to log in, so the contest is an untouchable world (of course it should be set so that you can not play with it)
- What about FTP?
If you decide to intervene with SSH port forwarding, it will be a little troublesome (it should not be impossible)
- What about WebDAV?
It can withstand SSH port forwarding and is unlikely to cause serious environmental damage.
So, I decided to look for a WebDAV server.
WsgiDAV was chosen
- Nginx is easy because I'm used to it (personally), but by default it lacks modules so I have to build the source.
- I'm not familiar with Apache and I'm not sure because there are many configuration files to touch. If Apache was required in the contest, there is no one to coexist well.
So I gave up on a major web server.
When I looked it up, WsgiDAV was very easy.
https://github.com/mar10/wsgidav
- I checked the operation on Ubuntu 20.04, but if Python is included, it should be okay on windows or Mac.
Installation
$ pip install wsgidav cheroot
Run
Operation check. It may be sudo depending on the environment.
$ wsgidav --host=0.0.0.0 --port=8080 --root=/home/ --auth anonymous
After that, try accessing with a browser or WinSCP.
After checking the operation, add nohup and execute.
$ nohup wsgidav --host=0.0.0.0 --port=8080 --root=/home/ --auth anonymous > /dev/null 2>&1 &
Impressions
It was too easy.