HUB
Sign inSign up

aevrin/samba

By aevrin

•Updated 3 days ago

Image
0

10K+

aevrin/samba repository overview

⁠samba-docker

A single-container Samba server with a small web UI for shares, users and per-share permissions. Built on aevrin/easy⁠ (Ubuntu + Apache + PHP); SWAG sits in front for HTTPS and auth.

⁠How it works

  • ./data/config.json is the source of truth. samba-helper turns it into Unix accounts, Samba passwords and /etc/samba/smb.conf.
  • The web UI (/app) calls samba-helper through one sudoers rule; the helper validates everything (usernames, share names, paths, settings) and refuses system paths like /etc, /app or /.
  • Samba's password database lives in ./data/samba/ so it survives container rebuilds. Unix accounts are recreated from the config on every boot.
  • smbd and Apache run side by side under run.sh; if either dies the container exits and restart: always restarts both.
  • Changes apply live (smbcontrol reload-config). Clients already connected may need to reconnect.

⁠Permissions

Each share has a per-user access level: No access, Read only, or Read and write. A share with nobody on it is switched off (Samba would otherwise let any logged-in user in).

Force user (optional, per share) makes every file land on disk owned by one account, whoever connects. Leave it empty and files belong to whoever wrote them. Every user's primary group is the share group (GID 1000 by default), and files are created 0664 / folders 0775.

User IDs only ever go up, so a new user never inherits files a deleted user left behind. You can set a UID by hand when adding a user, for example to match a file owner on the host.

⁠Upgrading from the env-var version

On first start with an empty ./data, the old variables are imported once:

VariableBecomes
USERNAME / PASSWORDfirst user, and the force user on imported shares
USER1..999 / PASS1..999more users
E1..999 / C1..999shares (path / name), every imported user read-write

That reproduces the old behaviour exactly; tighten it from the UI afterwards. After the import those variables are ignored. To re-import, stop the container and delete ./data.

WORKGROUP, ENCRYPTION, SIGNING and MIN_PROTOCOL are different: when set, they override the config on every boot and the UI shows those fields as locked.

⁠Setup

  1. Use the sample docker-compose.yml. Mount ./data to /app/data and each folder you want to share.
  2. Publish only 445. Put the container on SWAG's network and copy samba.subdomain.conf.sample into SWAG's proxy-confs, adding your auth include.
  3. Folders you share must be writable by the account that writes to them (the force user, or each user plus the share group). For example: chown -R 1001:1000 /Storage && chmod -R g+rwX /Storage.

The UI needs sudo to work, so don't set security_opt: no-new-privileges on this container.

⁠Notes

  • NetBIOS is off and only port 445 is used. Windows network browsing won't list the server, so connect directly (smb://host/share).
  • Encryption: Required also forces SMB3.
  • View smb.conf in the UI shows exactly what Samba is running.

Tag summary

Content type

Image

Digest

sha256:e162153ca…

Size

285.7 MB

Last updated

3 days ago

docker pull aevrin/samba