Minimal, fully guest browsable samba share

samba

This has been asked a million times before, and I've looked at a few hundred "solutions" spanning decades, none of which work 100%.

What I want:

A simple, minimal smb.conf that I can package up in an Alpine Linux based LXC container that is discoverable, browsable via WORKGROUP and allows full, unrestricted guest access to /mnt/shared without asking for a password. Something where a family member goes to "Network" on their computer (windows, mac, linux, chromeos), sees "Fileshare", clicks on it, and it just works (read and write access).

What I've tried:

  • messing with tons of settings like security = shared, security = user, map to guest = Bad User, guest account = nobody, force user = nobody, local master = yes, local master = no, various incantations of name resolve order, and a bunch of other things I can't remember at the moment.
  • Changing permissions and ownership to nobody, root, your-mother…
  • Looking through every forum, SO, SU, SF post about this EXACT SAME ISSUE and following the solution marked SOLVED, to no effect.
  • Of course tried https://wiki.samba.org/index.php/Setting_up_Samba_as_a_Standalone_Server
  • booted and rebooted and reinstalled and rebooted again every machine on my network.

Samba configuration is harder to get right than sendmail. Nothing ever seems to work quite right, such that any given config causes one or more of:

  • The server can't be discovered by browsing the network
  • The server can be browsed to manually, but doesn't automatically show up in the windows "Network" section
  • The server can be discovered by some systems but not others (mac, linux, windows)
  • The server can only be accessed via IP address, not by name
  • The client side keeps asking for a password to browse WORKGROUP
  • The client side keeps asking for a password to view the share itself
  • The client keeps complaining about permission problems, even after a chown -R
  • The client side keeps timing out
  • The client side is VERY VERY slow, taking 10-30 seconds for many operations

To make things worse, samba is very temperamental when it comes to environment, such that user accounts, permissions and ownership, and even mismatched network classes can cause it to fail spectacularly with generic error messages that don't help diagnose the problem.

So, what I'd like to know is: Can someone provide a clean smb.conf for a freshly made container that just works, for a full guest access, fully browsable, fully discoverable on all clients, non-slow share of a single directory? For example:

[global]
   map to guest = Bad User
   security = user
   guest account = nobody

[shared]
   path = /mnt/shared
   public = yes
   only guest = yes
   writable = yes
   printable = no
   force user = nobody

(note: The above config doesn't work)

I can adjust the environment to match whatever assumptions you want (though I'd prefer Alpine as a distro because it has less moving parts). I just want a minimal, baseline "guaranteed works" setup which I can then build out from incrementally rather than flailing about like I do every time I have to set up file sharing.

Then I can just make an lxc container template that has a canonical, guaranteed-to-work config and environment, and be done with it forever.

Best Answer

I've set up a server with a directory drwxrwxrwx jnl jnl /share/backup. This directory is shared via samba with following smb.conf:

[global]
workgroup = WORKGROUP
log file = /var/log/samba/log.%m
max log size = 1000
server role = standalone server
security = user
map to guest = Bad Password

[Backup]
path = /share/backup
writeable = yes
browsable = yes
guest ok = yes

With this configuration, I'm able to use the share under every other (Windows) OS directly without a user/password and with R/W rights. The files are created with -rw-r----- nobody nogroup FILE and folders with drwxrwxr-x nobody nogroup DIR.

If I want the share to be hidden, just set browsable = no.

Related Question