2010-10-06

FreeBSD - Quick setup of SAMBA file sharing server

Samba is a service that provides file sharing across BSD & Linux, that includes FreeBSD. Implementing Samba at the server allows maximum compatibility on file sharing across mac OSX, linux, BSD & other operating system. This post shows a quick & dirty way of installing & setting up Samba file server on FreeBSD.




Here's how to setup Samba file sharing service on FreeBSD server:

  1. Install Samba port, using portmanager with logging to /var/log/portmanager.log :
    portmanager net/samba3 -l
  2. Edit and append the below into Samba configuration file, /usr/local/etc/smb.conf :
    [newshare]
    path=/media/samba
    browseable=yes
    writeable=yes
    valid users = @general
    admin users = joe
    The above configuration will create a new Samba share, named "newshare", in the FreeBSD file system path of "/media/samba". It sets the samba share (newshare) as browseable & writable, when using a Samba friendly file manager. E.g. KDE's Konqueror, GNOME'S Nautilus, OSX Finder.
    This share "newshare" will be allow to access from all users of group "@general" & user "joe" will be able to create, change & delete it's contents.
  3. Add a FreeBSD group, named "general" :
    pw groupadd general
  4. Add a FreeBSD user, named "joe" :
    adduser
    Then answering the prompts on new user information
  5. Add a Samba User, preferably same as the previous step, named "joe" :
    smbpasswd -a joe
    The "smbpasswd" file will be created if it doesn't exist in /usr/local/etc/samba/. Do take note that the Samba configuration file (smb.conf) will still reside in /usr/loca/etc/.
  6. Configure rc to allow Samba file sharing service to be started :
    echo smbd_enable=\"YES\" >> /etc/rc.conf
    echo nmbd_enable=\"YES\" >> /etc/rc.conf
    echo winbindd_enable=\"YES\" >> /etc/rc.conf
  7. Finally, start the Samba file sharing service :
    /usr/local/etc/rc.d/samba start

This is a quick way of getting Samba file sharing up & running but Samba has so much more powerful features. Do refer to Samba's official Documentation for more functions & features.

Das Vidanya !!!

No comments: