People keep telling me that they have trouble getting Samba to work properly. I found it difficult to get working properly too, so here’s a guide that should make it a lot easier…
First of all, we need to install it! Make sure you have updated your Ports tree (see other posts) and then, as root:
This will show the configuration dialog box for options for the port. Using the space bar and cursor keys, deselect ALL the options, and then enable only these:
AIO_SUPPORT, FAM_SUPPORT, QUOTAS, PAM_SMBPASS, POPT
Press TAB to go to OK and press enter. Now you can build and install the port with:
make install distclean
It will go off and install dependencies if it needs to. If you see any other configuration boxes, just accept the defaults and move on.
This takes a while as it has to install quite a few packages/ports, mostly for the file alteration monitor support – but it’s worth it so be patient. If you already have X/gnome2 installed, this process will be much quicker.
Once the port is installed, we need to make a few changes to the limits within FreeBSD to make samba a little happier… edit /etc/sysctl.conf and add the following:
And we also need to add another kernel module. edit /boot/loader.conf and add the following:
Now, we need to tell samba to start on bootup, edit /etc/rc.conf and add the following:
And finally, we need to make ourselves a config file. Edit /usr/local/etc/smb.conf and remove its entire contents. Replace with the following template:
server string = Server Name
interfaces = em0
bind interfaces only = Yes
map to guest = Bad User
passdb backend = tdbsam
log file = /var/log/samba34/log.%m
max log size = 500
name resolve order = wins lmhosts bcast host
load printers = No
os level = 10
preferred master = No
domain master = No
dns proxy = No
wins support = No
ldap ssl = no
hosts allow = 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8
hosts deny = 0.0.0.0/0
case sensitive = Yes
level2 oplocks = Yes
oplocks = Yes
comment = Temp Folder
path = /tmp
guest only = Yes
guest ok = Yes
read only = No
Replace ‘interfaces’ with your network interface name (mine is em0)
Your windows netbios name, by default, will be the hostname of your FreeBSD server up to the first dot. E.g. for test.dan.me.uk the netbios name is TEST.
Reboot to startup samba with all the relevant changes. Browse to the server and you will see “tmp” share which is a user nobody access to /tmp.
Check the samba documentation on how to define other shares, such as per-user homedir shares.