The fastest way to share files with Windows, macOS and Linux. No setup. No passwords. No patience required.
Built with AI assistance — Idea and design by a human, code by an AI. Fully open source and auditable.
You know the drill: Your colleague needs a file. They're on Windows. You're on Linux. You could email it (if it's under 25MB). You could upload it to some cloud service (and wait). You could set up Samba (LOL, see you next week). Or...
sudo sambam /path/to/folderDone. They open \\your-ip\share in Explorer. Files are flowing. You're a hero.
sambam is like python -m http.server but for Windows network shares. One command, instant SMB file sharing.
| The Old Way | The sambam Way |
|---|---|
| Install Samba | sudo sambam . |
| Edit smb.conf | That's it. |
| Configure users | Seriously. |
| Restart services | You're done. |
| Debug permissions | Go grab coffee. |
| Google error messages | |
| Cry softly |
- Zero setup - One command starts sharing, no service install required
- Config is optional - Run CLI-only, use layered defaults (
/etc, home, local), or use explicit-cconfig-only mode - Anonymous by default - Guest access works out of the box
- Optional authentication - Add users/passwords via CLI or config
- Multiple shares - Share multiple directories with custom names
- Per-share ACLs -
allow_usersand share-levelreadonly - SMB3 encryption by default - Enabled automatically for authenticated sessions when client supports it
- Discovery support - mDNS (macOS) and WSD (Windows), with
--no-advertiseto disable - Auto-expire - Stop sharing automatically after a duration
- Daemon mode - Run in background with
sambam status/sambam stop - Cross-platform clients - Windows 10/11, macOS, Linux (CIFS mount)
- SMB 2.1 / 3.0 / 3.1.1 - Modern protocol support, including POSIX extensions
- Single binary - Runs on Linux distributions (Debian, Ubuntu, OpenWrt, etc.)
- Shell completions - Bash and Fish completion scripts included
Download artifacts from the Releases page.
Native packages are available for:
- Debian/Ubuntu (
.deb) - Fedora/RHEL/openSUSE (
.rpm) - Arch Linux (
.pkg.tar.zst) - Alpine (
.apk)
You can install the matching package for your distro, or use the standalone binary:
chmod +x sambam-linux-amd64
sudo mv sambam-linux-amd64 /usr/local/bin/sambamOr build from source:
go build -o sambam .# Share current directory (anonymous access, read-write)
sudo sambam
# Share a specific folder
sudo sambam /path/to/folder
# Share read-only with a custom name
sudo sambam -r -n photos ~/PicturesSet the share name. By default the share name is the directory name. Use name:path syntax to specify both name and path. Repeatable for multiple shares.
sudo sambam -n myfiles /data
sudo sambam -n docs:/home/user/documents -n pics:/home/user/photosAddress and port to listen on. Default: 0.0.0.0:445.
You can also bind by interface with @<name> (optionally with port), for example @eth0 or @eth0:445.
Repeat the flag to bind multiple endpoints.
sudo sambam -l 0.0.0.0:8445 /data
sudo sambam -l @eth0:445 /data
sudo sambam -l @eth0 -l 10.23.22.13:445 /dataAllowlist client source addresses. Repeatable.
Accepted values:
- Single IP (
192.168.1.10) - CIDR network (
192.168.1.0/24)
If one or more --allow rules are set, only matching clients can connect.
sambam -a 192.168.1.10 -a 192.168.2.0/24 /dataBy default, sambam advertises the SMB service for LAN discovery using:
- Bonjour/mDNS (
_smb._tcp) - WS-Discovery (Windows Network discovery)
Ports used by sambam:
TCP 445(SMB service)UDP 3702(WS-Discovery probe/resolve)TCP 5357(WS-Discovery metadata HTTP)
Use -x / --no-advertise to disable discovery announcements.
Set [global].discovery_name_mdns and [global].discovery_name_wsd in config to control discovery names for macOS (mDNS) and Windows (WSD).
sambam /data
sambam -x /data
sambam --no-advertise /dataShare in read-only mode. Clients can browse and copy files but cannot modify, delete, or upload.
Require authentication. Repeatable.
- Single-user quick mode:
-u admin -p secret(or omit-pfor random password) - Multi-user CLI mode:
-u alice:secret1 -u bob:secret2
sudo sambam -u admin /data
sudo sambam -u admin -p secret123 /data
sudo sambam -u alice:secret1 -u bob:secret2 /dataSet a password for single-user CLI mode (-u <user>).
For multi-user CLI mode, use -u <user:password> for each user.
Tier 1 — quick share:
sambam /data
sambam -u alice -p secret /dataTier 2 — multiple users (same access for all):
sambam -u alice:secret1 -u bob:secret2 /dataTier 3 — per-share permissions (config):
[user.alice]
password = "secret1"
[user.bob]
password = "secret2"
readonly = true
[share.media]
path = "/mnt/media"
[share.private]
path = "/home/user/private"
allow_users = ["alice"]
[share.public]
path = "/srv/public"
allow_users = ["guest"]Automatically stop sharing after the given duration. Accepts Go duration format: 30m, 1h, 2h30m, etc.
sudo sambam --expire 30m /dataShow real-time connection and file activity.
Use verbosity levels:
-vbasic activity-vvextended diagnostics (open mode, read events, close summaries, slow ops, auth failures)-vvvfull protocol trace (includes-vand-vv)
15:04:05 connect 192.168.1.100:54321
15:04:10 [share] create file documents/report.docx
15:04:12 [share] create dir backup
15:04:15 [share] delete temp/old-file.txt
Hide files starting with . from directory listings. By default dotfiles are visible.
Run sambam as a background daemon. Use sambam status to inspect it and sambam stop to stop it.
sudo sambam -d /data
sudo sambam status
sudo sambam stopPID file location for daemon mode. Default: /tmp/sambam.pid.
Log file path. In daemon mode, logs go to this file (otherwise daemon output goes to /dev/null). In foreground mode, logs are written to both terminal and this file.
If used without a value, defaults to /tmp/sambam.log.
Load config file(s) explicitly. Repeatable.
When -c is used, default discovery (/etc/sambamrc, ~/.sambamrc, ./.sambamrc) is skipped.
Files passed via -c are applied in order, and CLI flags still have highest priority.
sambam -c /etc/sambam-prod.toml -c ./sambam.override.tomlsudo sambam -d -L /var/log/sambam.log /data
sudo sambam -L /tmp/sambam.log /dataGenerate a TOML config from the currently passed CLI flags and exit without starting the server.
- If no path is given, writes
./.sambamrc - If a path is given, writes to that file
- Generated config includes users and shares based on passed flags
sambam -r -u admin -p secret -G
sambam -l 10.23.22.13:445 -e 1h -G /tmp/sambamrc.tomlShow version and exit.
Show help and exit.
sambam has two config loading modes:
- Default mode (no
-c):/etc/sambamrc->~/.sambamrc->./.sambamrc - Explicit mode (with
-c): only the provided-c, --config <path>files, in order (required to exist)
CLI flags override all config values.
[global]
listen = "0.0.0.0:445"
# listen = ["@eth0:445", "10.23.22.13:445"]
allow = ["0.0.0.0/0"]
advertise = true
smb3_encryption = true
guest_browse_ipc = true
show_connect_hints = true
discovery_name_mdns = "<hostname>-sambam"
discovery_name_wsd = "<hostname>"
readonly = false
hide_dotfiles = false
verbose = true
# verbose_level = 2
# verbose_level = 3
debug = false
trace = false
expire = "1h"
pidfile = "/tmp/sambam.pid"
logfile = "/tmp/sambam.log"
[user.alice]
password = "secret1"
readonly = false
[user.bob]
password = "secret2"
readonly = true
[share.docs]
path = "/tmp/docs"
allow_users = ["alice", "bob"]
readonly = false
[share.private]
path = "/tmp/private"
allow_users = ["alice"]
readonly = true
[share.public]
path = "/tmp/public"
allow_users = ["guest"]
readonly = falseGlobal options:
listen(string or array)allow(default: allow all, e.g.["0.0.0.0/0"])advertise(default:true)smb3_encryption(default:true; used when client supports SMB3 encryption)guest_browse_ipc(default:true; allows guest auth for IPC$/browse discovery even when shares require users)show_connect_hints(default:true; show Windows/macOS/Linux connect commands in startup banner)discovery_name_mdns(default:<hostname>-sambam)discovery_name_wsd(default:<hostname>)hide_dotfilesreadonlyexpirepidfilelogfileverbose/verbose_level
Per-user options ([user.<name>]):
passwordreadonly
Per-share options ([share.<name>]):
pathreadonlyallow_users
Notes:
allow_users = ["guest"]creates a guest-only (anonymous) share.allow_users = ["alice", "bob"]restricts a share to specific authenticated users.allow_users = ["guest", "alice"]allows both guest and selected users.smb3_encryptionis enabled by default. Setsmb3_encryption = falseonly for compatibility troubleshooting.- Guest sessions (
allow_users = ["guest"]) are not encrypted; use authenticated users if you require SMB encryption. guest_browse_ipc = trueimproves Finder "click discovered server" behavior on macOS while still enforcing share ACLs. Set it tofalseto require authenticated session setup from the start.
See sambamrc.example for a full example.
Run with verbosity to see exactly which config files were loaded:
sambam -vYou will see a line like:
config: loaded /etc/sambamrc, /root/.sambamrc, .sambamrc
Once sambam is running, it prints ready-to-use connection paths:
sambam v1.4.x
Sharing /home/user/documents
Share documents
Listen 10.23.22.13:445
Mode read-write
Auth anonymous
All connections:
Windows \\10.23.22.13\documents
macOS smb://10.23.22.13/documents
Linux sudo mount -t cifs //10.23.22.13/documents /mnt -o guest
sudo mount -t cifs //10.23.22.13/documents /mnt -o guest,vers=3.1.1,posix,cifsacl # POSIX
Press Ctrl+C to stop
From Windows:
- Open File Explorer
- Type the path in the address bar:
\\10.23.22.13\documents - Press Enter
- If authentication is required, enter the username and password
Or mount as a drive:
net use Z: \\10.23.22.13\documents
# With authentication
net use Z: \\10.23.22.13\documents /user:aliceMount using CIFS with SMB 3.0:
# Anonymous access
sudo mount -t cifs //server-ip/share /mnt/share -o guest,vers=3.0
# With authentication
sudo mount -t cifs //server-ip/share /mnt/share -o username=admin,password=secret123,vers=3.0sambam supports SMB2 POSIX extensions, which let Linux clients see real Unix permissions, owners, and use chmod/chown. This requires SMB 3.1.1:
# POSIX mount with chmod/chown support
sudo mount -t cifs //server-ip/share /mnt/share -o guest,vers=3.1.1,posix,cifsaclWith POSIX extensions, ls -la shows actual file owners and permissions from the server instead of defaults. The cifsacl option is required on kernel 6.1 for chmod to work; newer kernels (6.5+) may not need it.
Windows caches SMB credentials. If you're having authentication issues:
# List active connections
net use
# Disconnect a specific share
net use \\192.168.1.100\share /delete
# Or disconnect all shares
net use * /deleteAfter clearing cached connections, reconnect and Windows will prompt for new credentials.
Port 445 requires root. You can use a non-standard port instead:
sambam -l :8888 /dataLinux clients support non-standard ports natively:
sudo mount -t cifs //server-ip/share /mnt -o guest,port=8888Windows and macOS only connect to port 445. To use a non-standard port, create an SSH tunnel:
# Forward local port 445 to the sambam server
ssh -L 445:server-ip:8888 user@server-ipThen connect to \\localhost\share (Windows) or smb://localhost/share (macOS).
On Windows, port 445 is usually already in use by the built-in SMB service. A workaround is to run the tunnel inside WSL and bind to the WSL network interface:
# Inside WSL — find WSL's IP with: ip addr show eth0
ssh -L 172.x.x.x:445:server-ip:8888 user@server-ipThen connect from Windows using \\172.x.x.x\share (the WSL IP).
- Root privileges - Port 445 requires root (or use
-l :8888for a non-standard port) - Linux server - Works on any distribution (Debian, Ubuntu, OpenWrt, Alpine, etc.)
- Clients - Windows 10/11, macOS, or Linux (via CIFS mount)
These notes apply to the sambam server (the application serving files), not to client applications (Windows Explorer, macOS Finder, Linux mount tools, etc.).
Linux - Fully stable. All features working including POSIX extensions, file permissions, and advanced operations.
macOS (Apple Silicon) - Excellent support. Thoroughly tested and works as reliably as Linux. All features including POSIX extensions fully functional. No known issues.
Windows - Experimental server build
- No POSIX extensions support (limitations on Unix-style permissions)
- File deletion issues: Files cannot be deleted while the server is running (Windows file locking behavior)
- Other features work correctly
By default, sambam uses anonymous/guest authentication. This means:
- No passwords - Anyone on your network can access the share
- Use on trusted networks only - Don't run this on public WiFi
- Not for production - This is for quick file transfers, not Fort Knox
For sensitive shares, use --username to require authentication, and -r for read-only mode.
AGPL-3.0
Made for those moments when you just need to share a damn file.
