Windows workgroups: Samba


by ross at 16:36:31 on July 13, 2015


This is simple setup without Domain Controllers suitable for home network. Our goals:

  • Public share with read-write access for every user (named Public)
  • Read-only share (named Torrents)
  • User home directories


# cd /usr/ports/net/samba42
I use default options
# make install clean
# rehash

Add to /etc/rc.conf:

# Enable Samba

If you are running DHCP server add to /usr/local/etc/dhcpd.conf:

option netbios-name-servers;
option netbios-node-type 8;


Edit /usr/local/etc/smb4.conf (change interface name at least):

interfaces = re1
workgroup = LAN
netbios name = COFFIN
security = user
log file = /var/log/samba/log.%m
max log size = 50
domain master = yes
local master = yes
preferred master = Yes
os level = 255
wins support = yes

comment = Home Directories
valid users = %S
read only = No
browseable = No

comment = Public Data
path = /home/samba/public
force user = nobody
force group = nobody
read only = No

comment = Torrents
path = /data/torrents
read only = Yes
guest ok = Yes

Create logs directory:

# mkdir -p /var/log/samba

Create public directory:

# mkdir -p /home/samba/public
# chown nobody:nobody /home/samba/public
# chmod a=rwx /home/samba/public

Add your users:

We have local user "ross", add him to Samba:
# smbpasswd -a ross

Check config and start:

# testparm
# service samba_server start