FreeBSD - Samba Setup

Due to recent changes in Samba, learn about the utility pdbedit and why to use the tdbsam backend database instead of the smbpasswd backend database. See SAMBA documentation on Account Information Databases for useful background information.

Install the Samba Port

Install the samba package via portinstall -R net/samba3 or cd /usr/ports/net/samba3; make install clean.

Edit Samba Configuration File

Edit /usr/local/etc/smb.conf, which is installed with the Samba port.

Run testparm to test the configuration you just created.

Edit /usr/local/etc/rc.d/samba file

Edit /usr/local/etc/rc.d/samba to enable samba. This file was installed as part of the installation of the Samba port. Uncomment the line samba_enable="YES". You don't need to uncomment the line for winbindd_enable if you do not have a Windows domain controller in your local network.

Editing /etc/rc.d

This seems to be already set up on my machine when I upgraded to 7.2 and ran the script as part of that upgrade; the script added a line to /etc/rc.d so that it would run the rc.d system in /usr/local.

Run adduser and pw as needed

Run adduser to add any needed user accounts. Run pw to add any groups and modify group memberships.

Update Firewall Configuration to Permit Samba Communications on Your Network

What you need to do varies depending on what firewall you are using.

For ipfilter, I used the following rules in my ipfilter rules file build script:

Start Samba

/usr/local/etc/rc.d/samba start

Run pdbedit to Set Up User Accounts for Samba

pdbedit -a username will ask you for the password of the user you are adding.

Test Locally

Test the Samba configuration locally using the following command:

smbclient //yourMachineName/yourShareName -U validSambaUser

Back to FreeBSD main page