Windows workgroups: Samba

Configuration

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

Setup

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

Install

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

Add to /etc/rc.conf:

# Enable Samba
samba_server_enable="YES"
winbindd_enable="YES"

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

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

Configuration

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

[global]
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

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

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

[torrents]
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

 

Comments