Skip to content

Latest commit

 

History

106 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fileshare

A self-hosted file sharing server written in Go. Serve files and folders over HTTP with optional password protection, upload support, use limits, and expiration — managed through a web-based admin interface or a command-line tool. This tool was developed because I often wanted to send files to friends, only for my messengers to block them due to file size, since they were on my NAS anyway, so why not give them the direct link to a file or folder? Because there were no proper tools that were able to do this in a simple way without being massively overcomplicated, having user instances, etc., etc.

Features

  • Web admin UI — manage all shares from a browser, no terminal required
  • Password-protected shares — per-share passwords with token-based sessions
  • Upload support — allow others to upload files into a share via chunked upload
  • Expiration — time-based or use-count-based share limits
  • Directory listing — browse folders and download as ZIP
  • Live log viewer — stream server logs in real time from the admin UI
  • Dark mode — persisted per browser
  • CLI tool — full share management from the command line for scripting and remote access

Getting Started

1. Install

Just use the installer provided in the release. If you want to build it yourself, the install script is the same I've used in the development process, you can find it in the same place in the code itself.

The web UI lives in a submodule (wirezatUI), so clone with it:

git clone --recursive https://github.com/Wirezat/fileshare
# already cloned without it:
git submodule update --init

Without the submodule assets/web/ui stays empty and every page renders unstyled. go.sum is not tracked, so run go mod tidy before the first build.

2. First-time setup

Open http://localhost:<port>/setup or http://localhost:<port>/admin in your browser — /admin redirects there while no password is set.

The page asks for a setup code on top of the username and password. It is generated on every start that finds no admin password and written to the server log:

[INFO] no admin password set — open /setup and enter this setup code: 3f1c…

Without it the endpoint answers 403. This keeps a fresh instance from being claimed by whoever reaches it first — only someone who can read the server's own log can create the account. After setup, /setup is permanently disabled and you are redirected to the admin panel.


Admin UI

The admin interface is available at /admin and is split across three pages: /admin (shares), /admin/logs and /admin/settings.

Shares

Create and manage all shares from the shares tab. Each share maps a public URL subpath to a file or folder on the server.

Field Description
Subpath The URL path, e.g., docshttp://host/docs. Leave empty for a random value.
Path Absolute path to the file or folder on the server.
Max uses How many times the share can be accessed. -1 for unlimited.
Expires Optional expiration date and time.
Allow uploads Let visitors upload files into this share's directory.
Password Optionally protect the share with a password.

Shares can be edited, disabled, re-enabled, and deleted inline from the table. A disabled share remains in the list but is inaccessible until re-enabled.

Logs

Live server log stream at /admin/logs, with DEBUG / INFO / WARN / ERROR filters and a full-text search over the visible lines. Request log lines expand to their full JSON on click. The viewer loads the server's recent buffer over REST and then follows along via SSE. Clearing the view does not affect the log file on disk.

Settings

Setting Description
Change username Updates the admin username. Requires the current password, and ends every other session.
Change password Updates the admin password (stored as an Argon2id hash). Requires the current password, and ends every other session.
Delete expired shares Permanently removes all expired shares from data.json.

Share Behavior

Accessing a share

  • http://host/<subpath> — serves the file directly or shows a directory listing.
  • Directories can be downloaded as a ZIP via the ?download=zip query parameter.
  • If the share has a password, visitors are shown a password gate before accessing the content.

Password-protected shares

Entering the correct password sets a session cookie scoped to that subpath. The session is valid for 24 hours. Each share's password is stored as an Argon2id hash; bcrypt hashes written by older versions are still accepted and upgraded on the next successful unlock.

Uploads

When a share has uploads enabled, visitors can drag and drop files onto the listing page. Uploads use a chunked protocol with crash-safe resume support.


CLI

The CLI tool provides full share management for use in scripts or over SSH. It reads and writes data.json directly.

A running server will not see CLI changes. The server caches the config in memory, so add, edit, delete, disable and prune only take effect after systemctl restart fileshare. Changes made through the admin UI apply immediately, because they go through the same process that holds the cache. Note: This was the original interface for the program, so I wanted to keep it as a legacy option. Since I've made the WebUI, its updates are entirely Vibe Coded, but it should work without problems. I guess. I haven't put the most of work into it

fileshare <command> [options]

Commands

Command Description
list Show all shares with status, expiration, upload flag, and password indicator.
add Create a new share.
delete Delete a share.
edit Edit an existing share (path, subpath, uses, expiration, upload, active state, password).
enable Re-enable a disabled share.
disable Disable a share without deleting it.
prune Delete all expired shares permanently.
setpassword Update the admin password. Prompts for the current password if one is set.
setusername Update the admin username. Prompts for the current password if one is set.
help <command> Show detailed help for any command.

Quick reference

# List all shares
fileshare list
fileshare list --json

# Add a share
fileshare add -f /srv/files/report.pdf -s report -e 7d -u 10
fileshare add -f /srv/uploads -upload           # random subpath, uploads enabled
fileshare add -f /srv/secret.zip -pw hunter2   # password-protected

# Edit a share
fileshare edit -s report -e 30d -u 50
fileshare edit -s report -pw newpassword
fileshare edit -s report -clear-password
fileshare edit -s report -active=false         # disable without deleting

# Enable / disable
fileshare disable -s report
fileshare enable  -s report

# Delete
fileshare delete -s report

# Clean up expired shares
fileshare prune -y

# Update admin credentials
fileshare setpassword
fileshare setusername -u newname

About

A simple go program that reads files from a json and hosts them under a link

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages