FreeBSD Samba how-to based on the one at www.bsdvault.net. Some errors have been corrected (from the original at bsdvault.net), but please let us know if you find any in this version.
1) Install the Samba port
cd /usr/ports/net/samba && make install
2) Read the files in /usr/local/share/doc/samba
They will help to drag you out of the pit of ignorance.
3) Copy /usr/local/etc/smb.conf.default to /usr/local/etc/smb.conf
4) Before you edit smb.conf you will need a shared files directory. I tend to use /usr/smbshares/files so that will be used in this example:
mkdir -p /usr/smbshares/files
You’ll need to chmod
chmod 0775 /usr/smbshares/files
Then chown (I tend to use smbguest:0 as I often need to write to the shared directory using my wheel grouped user)
chown owner:group /usr/smbshares/files
5) You will also need to create the file locks and logging directories:
mkdir /usr/local/locks
mkdir /var/log/samba
6) Create a guest account if you dont have one on your box already I use smbguest
Your entry for the smbguest account in /etc/passwd must look something like this:
smbguest:*:1002:1002:Samba Guest:/nonexistent:/sbin/nologin
Note the lack of a home directory and the use of the nologin shell, this is important.
7) Now edit the config file. It comes with lots of examples but for simplicity I provide BASIC lines here:
[global]
workgroup = FIGARO
hosts allow = 192.168.1. 127.
guest account = smbguest
log file = /var/log/samba/log.%m
max log size = 50
security = user
encrypt passwords = yes
socket options = TCP_NODELAY
[files]
comment = Files
path = /usr/smbshares/files
guest = yes
public = yes
writable = yes
printable = no
8) Add encrypted passwords for Samba users:
cd /usr/local/private
mv smbpasswd smbpasswd.orig
touch smbpasswd
chmod 0600 smbpasswd
Now create one for each user:
/usr/local/bin/smbpasswd -a (username)
9) Copy /usr/local/etc/rc.d/samba.sh.sample to /usr/local/etc/rc.d/samba.sh
cp /usr/local/etc/rc.d/samba.sh.sample /usr/local/etc/rc.d/samba.sh
10) Type /usr/local/etc/rc.d/samba.sh or reboot.
Done
Contributed by: Crimson



