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:

Code:
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:

Code:
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

Code:
#Global Parameters
[global]
workgroup = wrkgrpname
server string = Samba
interfaces = 192.168.32.1/28 (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
[tmp]
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:

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

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

Code:
#!/bin/sh
smbspool=/var/spool/samba
pidfiledir=/var/run
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

Code:
swat 901/tcp #Samba web admin tool.
Second edit /etc/initd.conf by appending with these 2 lines:
Code:
#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