creating network shares with Samba 3.x on FreeBSD 6.x
Jan 3, 2010

The configuration defined below emulates a shared drive on a Windows PC with minimal security. It does not require users enter a password - it assumes that any user on the local network is valid. It implements Samba's share-level security; the resulting volume works similarly to a share on a Windows system, where permissions to the share are set to 'Everyone - Full Control'. This kind of setup is useful for a home or small business network, where security is not highly valued.

If you'd like security as well, consider using password-protected shares ("user-level" security). If you have multiple servers, see creating a PDC and creating a member server.

See also: troubleshooting Samba

Process:

  1. cd /usr/ports/net/samba3
  2. make install clean (this requires a live internet connection, and takes a while)
  3. select at least syslog (and CUPS if you want to use the FreeBSD box as a printserver)
  4. cd /usr/local/etc
  5. cp smb.conf.default smb.conf
  6. chmod 644 smb.conf
  7. vi smb.conf
  8. in the [global] section, change workgroup name to correct name, example: MY_GROUP
  9. in the [global] section, set the security mode to share
  10. in the [global] section, uncomment the hosts allow line and change it to permit access only from the local LAN and localhost, example: 192.168.0. 127.
  11. in the [global] section, set domain master and preferred master to Yes
  12. In the [global] section, set os level = 255

    Note: these last three settings will cause this server to become the master browser on your LAN. Only one server should be the master browser. Do not set these on more than one server.

  13. in the [global] section, adjust log size if necessary (remember this is per machine)
  14. create a section in the config file for the share (do this in the "share definitions" section):
    [public]
    comment = description of the share (optional)
    path = /data/smbspace
    read only = no
    public = yes
    
  15. save the changes and exit the editor
  16. create share directory: mkdir /data/smbspace
  17. set permissions on share directory: chmod 777 /data/smbspace
  18. vi /etc/rc.conf
  19. add a new line to the end of the file to enable Samba on boot: samba_enable="YES"
  20. save the changes and exit the editor
  21. start the daemon: /usr/local/etc/rc.d/samba start