by Coltrane
(Transferred from the wiki by Peter)

  • Install the Samba port! (or rpm, or source, or deb package); check out the docs in the /usr/local/share/doc/samba
  • Now you must create a shared directory serve files from:

bash$>mkdir /usr/smbshares/directories
bash$>chmod 0775 /usr/smbshares/directory
bash$>chown owner:group /usr/smbshares/directory
drwxr-xr-x root wheel /usr/smbshares
drwxrwxr-x root eng seceng
drwxrwxr-x root gimp gimpfiles
  • Create the file locks and logging directories:

bash$>mkdir /usr/local/locks
bash$>mkdir /var/log/samba
  • Create a guest account if you dont have one on your box already...

  • copy /usr/ports/net/samba/work/samba-2.0.x/examples/smb.conf.default to /usr/local/etc/smb.conf and edit it to get basic services started

#Global Parameters
workgroup = wrkgrpname
server string = Samba
interfaces = (variable)
security = SHARE
encrypt passwords = YES
password level = 2
username level = 2
log file = /path to logfile specified above
max log size = 50 (default)
lock dir = /lock dir specified earlier
guest account = pcguest
comment = (your coments here)
path = /usr/tmp
read only = No
directory mask = 0775
guest ok = yes
browseable = No
  • Start the Samba daemon and check the server is visible from other machines on net:

bash$>/usr/local/sbin/smbd -D
bash$>/usr/local/sbin/nmbd -D
  • Add encrypted passwords for Samba users:

bash$>cd /usr/local/private
bash$>mv smbpasswd smbpasswd.orig
bash$>touch smbpasswd
bash$>chmod 0600 smbpasswd
Now create one for each user:
bash$>/usr/local/bin/smbpasswd -a (username)
  • Create /usr/local/etc/rc.d/

echo -n 'smbd'
/usr/local/sbin/smbd -D
echo -n 'nmbd'
/usr/local/sbin/nmbd -D
  • Time to set up SWAT. First edit /etc/services by adding this line

swat 901/tcp #Samba web admin tool.
Second edit /etc/initd.conf by appending with these 2 lines:
#Samba web admin tool
swat stream tcp nowait.400 root /usr/local/sbin/swat swat
Now go to http://localhost:901 and log in as root.
  • All the rest can be dont through swat to edit shares and what not.. Congrats on a working Samba server.

Working on a part 2 with more advanced configs now