Creating Samba Shares with SWAT

Howto Create Samba Shares on Linux with SWAT

Creating Samba Shares


SWAT (Samba Web Administration Tool) is a Graphical User Interface used for the configuration of Samba's smb.conf file. SWAT allows you to easily configure your Samba server and create, modify or delete shares quickly. Below is a quick overview of the process involved in creating Samba shares using the SWAT interface. First you will need to access the SWAT interface using your choice of internet browser. To access SWAT, enter the IP address of the server where Samba and SWAT is installed. You also need to specify the port number as part of the address: http://192.168.0.27:901 (Change IP address to match your configuration).



Home Screen


If successful you should see a screen similar to the screen shot below. Here you will see various icons and links to documentation resources.


Samba SWAT Home Screen

The main sections we will be working with will be the "Shares" section and the "Global" section. The Global section allows you to define Global variables and settings to be used by all shares.


Global Screen


From the "Global" screen we are going to define a couple of settings to allow us to create a simple Samba share to a Windows Operating system.

Firstly we will define our "workgroup" name. This is the name of the Windows Workgroup or Domain. This entry should be in upper case (Capitals). In the example, we are going to use the workgroup name "WORKGROUP".

security we are going to set to user.

hosts allow we are going to open to all computers on the network "192.168.0.0/24". The logging area should be defined by default to "/var/log/samba/log.%m. It is always wise to define an area for logging errors as this will be useful if you ever have to debug a connection problem with a particular user and a share. The default logging will create a log file for each machine/user.

Help is available for each individual parameter. Simply click the "Help" link to the left of the parameter for a full description.

The image below shows the top section of the Global screen only

Commit Changes - Remember to click on the "Commit Changes" button to update the smb.conf file with your changes!


Samba SWAT Global screen

Shares


To create a new share we have to type the name of the share into the text box next to the "Create Share button. In the example I have used the name samba. Once you have entered the name of your share, you need to click on the "Create Share" button. This will create a new share entry.


Samba SWAT Create Share Screen

Once the "Create Share button is pressed you will be presented with a screen where you can define the path, security settings and other options. First we need to specify the location for our share called "samba". This can be found under the first heading of Base Options. This is the directory where you files are to be shared from. In the example I am using the following location:


Base Options


path: /home/john/lol


Security Options


read only: yes
Specifies that users can only read the contents.

hosts allow: 192.168.0.0/24
Specifies that anyone on the network 192.168.0.0/24 can see the share. You may specify more than one IP address here. (Amend accordingly to match your network addressing scheme)

browsable: yes
This option allows the share to be visible to net view commands.


Miscellaneous Options


available: yes
The "available" option allows you to switch the service on or off for a particular share.


Save Your Changes


Commit Changes - Remember to press the commit changes button.


Samba SWAT Create Share Screen

Note, Once the above changes have been made and committed, these are then saved in the "/etc/samba/smb.conf" file. Notice, only values that you have changed that are not default values will be reflected within the configuration file.


View your current configuration file


To view the current status of your configuration file, you need to click on the "Status" icon. Here you will be able to see your "smb.conf" file.


Samba SWAT Create Share Screen

Connecting to our Share from a Windows PC


In this example I have connected to the previously created Samba share using a Windows 7 PC. To connect to the share from Windows, simply type the IP address of the server into the search box and then double click on the server entry that appears. First you will need to authenticate yourself with the remote Samba share:


Samba Share Login Windows

Type in your userid and password (This will be userid/password you use on the remote server). Now click "OK". If all went well you should now see the share "samba" displayed:


Samba Share Windows

To access the contents of this share, simply double click the samba folder. You should now be able to see the contents of the shared folder:


Samba Share Windows files

Although the above share is very basic, it illustrates how quickly and simply you can create a share using the SWAT tool.