Introduction

SWAT - the Samba Web Administration Tool provides a really quick and easy way to set up a Samba server, with more powerful configuration options available to those who need them. It's already part of the Samba package that is available from pkgsrc, and you don't even need to install and configure an HTTP server like Apache to use it.

In this tutorial I will go through the steps I took to set up a share on my NetBSD machine, so that the machine's hard drive could be used for storage by the Windows PC's on the network. The 'guest' account is used for access and I won't go into how to set up users and passwords, so this solution would probably be more suitable for home networks.

Install Samba and enable SWAT

The first step is to fetch, build and install Samba:

 # cd /usr/pkgsrc/net/samba
 # make install clean

Next, put scripts in /etc/rc.d so that smbd and nmbd will be started automatically when NetBSD boots up. I simply used the example scripts that came with NetBSD.

 # cp /usr/pkg/share/examples/rc.d/smbd /etc/rc.d/
 # cp /usr/pkg/share/examples/rc.d/nmbd /etc/rc.d/

You also need to add the following lines to /etc/rc.conf

 smbd=YES
 nmbd=YES

SWAT can be enabled by adding the following line to /etc/inetd.conf

 swat stream tcp nowait.400 root /usr/pkg/sbin/swat swat

Now, restart inetd to enable SWAT

 # /etc/rc.d/inetd restart

Use SWAT to configure the Samba server

You should now be able to access SWAT by surfing to http://:901/ where is the IP for your NetBSD machine (or localhost if you are accessing SWAT locally). Login as 'root' with your system's root password. You will be taken to SWAT's main menu.

First, click on the 'Globals' icon, and use that menu to configure global options such as the 'workgroup' your Samba server is to be part of. If you don't understand what an option does, click the 'help' link next to it. Use the 'commit changes' button to save your work.

Next, click on the 'Shares' icon. To create a share, type a name into the text box and click 'create share'. You will now be able to specify the path to the folder that you want to share. To make the share accessible to anyone on the network without a password, change 'guest ok' to 'yes' using the drop-down menu. Change 'read only' to 'no' if you want other machines on the network to have read/write access to your shared folder.

Finally click on the 'Status' icon. From here you can start/stop/restart the Samba server without having to issue any commands at the command line. Just click 'start smbd' and 'start nmbd'.

Your shared folder should now be accessible by the other machines on the network...To check this out, use 'Network Neighbourhood' in Windows or KDE users can surf to smb:/ in Konqueror...