Linux.com

Home Learn Linux Linux Tutorials Samba Configuration with Webmin

Samba Configuration with Webmin

You may have read my recent article "Easy Samba Setup," which illustrated just how easy it can be to set up the Samba file and print server. Yes, that task can be easy, but the method I outlined does require you to take advantage of the command line. There are a lot of users who shy away from the command line as if it were the plague. For those users there are options. One of those options is the Samba tool from the Gadmin suite of tools.

The Webmin administration tool is a very powerful suite of web-based admin tools (for the Linux operating system) that have been around for some time. Webmin includes numerous modules covering nearly every aspect of Linux administration. Such tools include:

  • DHCPD
  • Bind
  • Apache
  • CVS
  • Procmail
  • SSH
  • Samba
  • and hundreds of others.

In this article I will show you how to install Webmin and use it to configure your Samba server.

Installation

Everyone who despises the command line will be happy to know that installing Webmin is fairly simple to install...for the most part. There are dependencies that must be met, which will be determined by your system. And, if you choose to ignore the command line, there is a small glitch that must be resolved - fear not, it's simple. I want to focus this tutorial on the new user - one who does not want to have to deal with the command line. To that end, let's get around the issue of dependencies with the help of Synaptic. I want to show you this method because there can be an issue when installing Webmin from the binary package found on the site. Let's use Ubuntu as an example. Follow these simple steps:

  1. Hit the F2 key combination.
  2. Enter sudo synaptic and hit the Enter key.
  3. Search for "perl" (no quotes) and mark it for installation.
  4. Search for "libnet-ssleay-perl" and mark it for installation.
  5. Click Apply to install.

Now that you have the dependencies out of the way, this is where it gets somewhat tricky. You can take the time and install using the source code of Webmin. During that installation there will be numerous questions asked. It's really not difficult. If you want to go that route, here are the steps:

  1. Download the tar from the Webmin site.
  2. Open up a terminal window and change to the directory the Webmin tar file was saved.
  3. Unpack the tar with the command tar xvfz webmin-XXX.tar.gz Where XXX is the release number.
  4. Change into the newly created directory with the command cd webmin-XXX Where XXX is the release number.
  5. Issue the command sudo sh setup.sh
  6. Answer the questions asked.

You see, that's not really all that difficult. If, however, you want to go an easier route follow these steps:

  1. Download the .deb package from the download site.
  2. Open up a terminal window and change to the directory housing the .deb file.
  3. Issue the command sudo dpkg -i webmin-XXX.deb Where XXX is the release number.
  4. If you managed to install all the dependencies, Webmin will install. If not, fear not.
  5. If you did get an unmet dependency, open up Synaptic.
  6. Synaptic will inform you there are broken packages.
  7. Click Edit > Fix Broken Packages.
  8. Click Apply.
  9. If you had to fix broken packages, go back and re-run the dpkg command to re-install Webmin.

You should now be ready to fire up the tool.

Using Webmin to Configure Samba

Webmin Main WindowNow it's time to set up Samba. At the end of the Webmin installation, you will be given instructions on how to reach the tool. Most likely that will be https://localhost:10000. Give that url a try in your favorite browser. That url should bring up the Webmin main page.

From this main page click on the Servers link in the left navigation. When you click the Servers link it will expand to show you the various modules you have installed. Of those modules, Samba will be one. Click on the Samba entry to open up the Samba configuration page.

Now I am going to walk you through the steps in order to quickly create a Samba share on your machine. I am going to assume a rather simple route - that you want to share out the /home directory to all users on the system and you want to give both read and write access to users. Here are the steps:

Here I already have created the new share.1. Click on the Create a New File Share from the top section (see Figure 2).

2. In the new window you will need to enter the following information:

a) Share name: Give your share a name.

b) Directory to share: Choose the directory you want to share.

c) Comment: Add a comment if you need.

d) Leave the rest as default (we will change some of this next).

e) Click Save.

You will now find yourself back at the Share listing. You want to click on your newly created share so you can make some more advanced configurations. When your share opens up you will now find a few more options available:

  • Security and Access control
  • File Permissions
  • File Naming
  • Miscellaneous Options

Security access controlsThe first thing you want to do is click on Security and Access control. In this window (see Figure 3) you will want to take care of the following:

  • Make sure the share is writable.
  • If you want to allow guest access make sure it is checked.
  • If you want to change host access do so in hosts to allow and hosts to deny.
  • If you want to add valid users enter the users in the Valid users listing.

Once you have configured this section, click Save and you will be back at your share setup page.

The File Permissions is the next section. In this window there are four options you need to check:

  • New Unix File mode
  • New Unix directory mode
  • Force Unix file mode
  • Force Unix directory mode

If you want your users to have both read and write access to the share, you need to see all of these to 755. Once you have done that click Save. Of course within these configurations, you can really get granular with your Share set up. I am only showing you how to create the easiest Share with the most access.

Once you have your Share complete there is but one step left: add users to Samba.

Convert usersUser Configuration

Go back to the Samba module page on your Webmin installation and scroll down a bit. You will see the section for Samba Users. Click on the Convert UNIX Users to Samba Users link. On this new page (see Figure 4) click the Convert Users button and all of your existing users will be added to the Samba system. Now any user will be able to access your Samba shares.

Finally, go back to the main screen and click the Restart Samba Servers button. Your users should now be able to access the shares on that system.

A Few Tips

There are a few things you should remember.

1) If you add a new user to the system, don't forget to convert that user to a Samba user.

2) If you need to add a new user to share access, don't forget to do so through the Security and Access window of the share.

3) If you have Windows users that need to access shares, make sure they have an account on the Samba server that matches (both username and password) on the Windows machine. NOTE: This is only necessary when using SECURITY = USER.

Final Thoughts

Samba used to be an incredibly difficult system to configure. This is no longer the case. Whether configured from the command line, from the GNOME desktop, or from Webmin, just about anyone can get a Samba share shared out to users. Please note: This setup I have outlined does not create the most secure system. If security is a concern, you will want to make sure you go through this process again with a closer eye on security and sharing issues unique to your environment.

 

Comments

Subscribe to Comments Feed
  • evanino Said:

    Yeah.... NO! followed to the letter, did not work.. BTW, can't enlarge the photos you have.. save image to my computer, then you can open it.

  • Santiago Navarro Said:

    I can't believe this actually worked. I tried to do exactly as it says. Linux Mint 17 KDE and Windows 7 Ultimate SP1


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board