home | tags


quick file server setup

tags: #file-server #web-GUI #nettool

[Updated 2023-09-17]

python http.server

If you want to quickly serve a directory for someone to access on a temporary basis, it’s easiest to run python’s http.server module:

$ python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...

This seems pretty good for basic file serving. (Actually it even has a --cgi option so that you can run cgi programs from a subdirectory called cgi-bin, but I have not explored that beyond checking that it does execute the program specified in the URL).

filebrowser

2025-01-26 Obsoleted by copyparty; see blog post on that [TBD]

A much better option is to install the single, statically linked, binary called filebrowser from https://github.com/filebrowser/filebrowser/releases. If you want to maintain security, your first run should be something like:

filebrowser --username=nimda --password=$(./filebrowser hash nimdapass)

(where nimda is the name of the admin username, and nimdapass is the password). You should do this first.

Then run it from some “workspace” directory, create subdirectories if needed, and create users. Give a user a “scope” of, say, “./subdir1” to limit him to that subdirectory. Assign minimum permissions (just Download only, or Download+Create+Edit, or all except “Execute Commands”, “Share Files” and of course “Administrator”).

Now that user/password can do all those things in that sandbox.

Configuration of filebrowser can be done using the web-GUI, though commands also exist if you want to script them. Documentation is not great but the basics work fine even without reading any docs!

sftpgo

2025-01-26 Probably Obsoleted by copyparty; see blog post on that [TBD]

If you want a much more powerful tool, try sftpgo (https://github.com/drakkan/sftpgo). This is not a single file binary, but it’s still pretty easy to install.

Sftpgo is a very powerful tool. It can serve files over sftp, https, and webdav. It can serve files from local directories, or S3 type and other cloud storages. Like filebrowser, all configuration is from a web-based GUI. You can create users and set up pretty powerful access control and even quotas. Users can authenticate using passwords, or ssh keys, and you can also add 2-factor authentication.

It also has a quick “portable” mode to serve up a directory with read and write capability. Just run

./sftpgo portable -d DIR-TO-SERVE -u user -p pass [-s port] -g '*'

However this can only be accessed by sftp, not http.