LJ Archive

The Open-Source Classroom

Webmin—the Sysadmin Gateway Drug

Shawn Powers

Issue #219, July 2012

Manage your Linux server without ever touching the command line.

Whenever I introduce people to Linux, the first thing they bring up is how scary the command line is. Personally, I'm more disturbed by not having a command line to work with, but I understand a CLI can be intimidating. Thankfully, not only do many distributions offer GUI tools for some of their services, but Webmin also is available to configure almost every aspect of your server from the comfort of a GUI Web browser.

I have to be honest, many people dislike Webmin. They claim it is messy, or that it doesn't handle underlying services well, or that the whole concept of root-level access over a Web browser is too insecure. Some of those concerns are quite valid, but I think the benefits outweigh the risks, at least in many circumstances.

What Is Webmin?

Like the name implies, Webmin is a Web-based administration tool for Linux. It also supports UNIX, OS X and possibly even Windows, but I've only ever used it with Linux. At the core, Webmin is a dæmon process that provides a framework for modules. Those modules, in turn, offer a Web-based GUI for configuring and interacting with dæmons running on the underlying server. Modules also can be used to interact with user management, system backups and pretty much anything else a user with root access might want to control.

Webmin comes with a huge number of built-in modules that can manage a large selection of common server tasks. The infrastructure is such that authors also can write their own modules or download third-party contributed modules. With the nature of Webmin's root permissions, third-party modules can be a scary notion, so it's unwise to install them willy-nilly.

Installation

The Webmin installation instructions are on its Web site: www.webmin.com. You can download an RPM or deb file if your distribution supports it, but Webmin also supplies a tarball along with installation instructions for most systems. If you use the RPM or deb files, I highly recommend installing the APT or YUM repository rather than directly installing the downloaded package. Not only will that allow for dependency resolution, but it also means updates will occur with your system updates.

If you use the tarball for installation, the setup.sh script will walk you through all the configuration settings. This is the proper way to install Webmin for Linux distributions like Slackware, which don't support RPM or deb files. Be sure during the configuration process that you select your specific distribution, otherwise Webmin won't handle the config files for your various services properly.

What's the Secret Sauce?

The thing I've always liked about Webmin is the lack of magic. The underlying configuration files on your system are configured using the appropriate syntax and can be edited by hand if you prefer. In fact, if you already have configured services on your server, Webmin usually will read the configuration properly.

Sometimes it's a great way to learn the proper method for configuring a particular service by configuring it with Webmin and then looking at what changes were made to the config files. This is helpful if you can't remember (or don't want to be bothered with researching) the particular syntax. I've learned some pretty cool things about configuring virtual hosts in Apache by looking at how Webmin sets them up.

It's important to note that Webmin can be configured to work over non-encrypted HTTP, but because very sensitive data (including a user account with root access!) is transmitted via browser, SSL is enabled and forced by default. This means annoyance with unsigned certificates at first, but using standard HTTP is simply a horrible idea.

So What Does It Do?

Once Webmin is installed, it should detect installed applications on your server and enable the appropriate modules. To log in, point your browser to https://server.ip.address:10000, and log in with either the root account or a user with full sudo privileges. The latter is preferable, as typing a root user/password into a Web form just gives me the willies.

The first page you'll see is a dashboard of sorts. Figure 1 shows the details of my home server. It's been 44 days since our last extended power outage (my uptime); I have some packages to update, and my file server is almost full. The dashboard doesn't offer earth-shattering information, but it's a nice collection of quick stats. The notification about 44 package updates available also is a hyperlink, which leads to the apt module. It makes for a very simple point-and-click way to keep your system updated.

Figure 1. The dashboard is simple, but quite useful.

Along the left side of the dashboard, you'll notice expandable menus separated into subject areas. I've never really liked the categories in Webmin, because so many modules naturally fit into more than one. Still, I appreciate the attempt at organization, and I just search the menus until I find the module I'm looking for. Figure 2 shows a mostly expanded screenshot of the menu system. These are merely the services and features Webmin detected when it was installed. There is still the “Un-used Modules” menu, which contains countless other modules for applications I don't have installed.

Figure 2. The sheer number of Webmin modules is overwhelming, but awesome.

The Mounds of Modules

Going back to those packages that need to be updated, clicking on the “Software Package Updates” module (or just clicking the hyperlink on the dashboard) will give you a listing of the outdated packages. Figure 3 shows my system. I've scrolled down to the bottom of the list to show some of the little extras Webmin offers. There is a button to refresh the package list, which upon clicking would execute sudo apt-get update in the background and then refresh the page with whatever updates are available. The same sort of thing happens when pressing the “Update Selected Packages” button; it just offers a quick-and-clicky way to run apt-get update. Below those buttons, you can see a nifty scheduling option for installing updates automatically. Like most things with Webmin, this isn't some proprietary scheduler, it simply runs cron jobs in the underlying system.

Figure 3. A GUI tool for updates on a headless server is very nice.

Other common system configuration tasks are available as modules too. Figure 4 shows the crontab configuration tool. Figure 5 shows the upstart configuring (which dæmons are started on boot), and Figure 6 shows the interface for viewing log files. All of these things are configurable from the command line, but the simple, consistent interface can be a time-saver, especially for folks unfamiliar with configuring the different aspects of their system.

Figure 4. Cron jobs are simple to edit with Webmin.

Figure 5. It got confusing when Ubuntu switched to upstart from sysv, but Webmin handles it just fine.

Figure 6. Not only can you view logs, you can manage them as well.

Servicing Servers

I've been a sysadmin for 17+ years, and I still need to search the manual in order to get Apache configuration directives right. I think it's very good for sysadmins to know how programs like Apache work, but I also think it's nice to have a tool like the Webmin module (Figure 7) to make changes. Whether you need to add a virtual host or want to configure global cgi-bin permissions, Webmin is a quick way to get the right syntax in the right place.

Figure 7. Apache has so many options, keeping track of them can be like herding cats. Webmin helps.

The MySQL Module, shown in Figure 8, is a very functional alternative to both the command-line MySQL interface and the popular phpmyadmin package. I've found it to be a little less robust than phpmyadmin, but it has the convenience of being contained within the Webmin system.

Figure 8. The MySQL module is very functional, with a consistent interface.

I won't list every service available, but here are a few of the really handy ones:

  • SSH Server: great for managing user access and system authentication keys.

  • Postfix/Sendmail: e-mail can be tricky to configure, but the GUI interface makes it simple.

  • Samba: there are a few other Web-based Samba configuration tools, but Webmin is very functional and straightforward.

When Configuration Isn't Enough

It's clear that Webmin is a powerful and convenient tool for system configuration. However, some other features are just as useful. If you look back at Figure 2, you'll notice a bunch of modules in the “Others” section. Most are fairly straightforward, like the File Manager. Modules like the Java-based SSH Login or the AJAX-based Text Login are very useful if you need to get to a command line on your server, but don't have access to a terminal (like when you are on your uncle's Windows 98 machine at Thanksgiving dinner and your server crashes, but that's another story).

Figure 9. The command line in a browser is helpful in a pinch, but too slow for regular use.

Another nifty module is the HTTP Tunnel tool (Figure 10), which allows you to browse the Web through a tunnel. This certainly could be used for nefarious purposes if you're trying to get around a Web filter, but it has righteous value as well. Whether you're testing connectivity from a remote site or avoiding geographic restrictions while abroad, the HTTP Tunnel module can be a life-saver.

Figure 10. The HTTP Tunnel is a cool feature, but it can be slow if you have a slow Internet connection on your server.

When Webmin Isn't Enough!

If you were thinking how great Webmin is for the sysadmin, but you wish there were something end users could use for managing their accounts, you're in luck. Usermin is a separate program that runs on the server and allows users to log in and configure items specific to their accounts. If users need to set up their .forward file or create a procmail recipe for sorting incoming mail, Usermin has modules to support that. It will allow users to configure their .htaccess files for Apache, change their passwords, edit their cron jobs and even manage their own MySQL databases. Usermin basically takes the concept of Webmin and applies it to the individual user. Oh, and how do you configure the Usermin dæmon? There's a Webmin module for that!

Webmin is a tool that people either love or hate. Some people are offended by the transmission of root-level information over a browser, and some people think the one-stop shop for system maintenance is unbeatable. I'm a teacher at heart, so for me, Webmin is a great way to configure a system and then show people what was done behind the scenes in those scary configuration files. If Webmin is the gateway drug to Linux system administration, I think I'm okay with that.

Shawn Powers is the Associate Editor for Linux Journal. He's also the Gadget Guy for LinuxJournal.com, and he has an interesting collection of vintage Garfield coffee mugs. Don't let his silly hairdo fool you, he's a pretty ordinary guy and can be reached via e-mail at info@linuxjournal.com. Or, swing by the #linuxjournal IRC channel on Freenode.net.

LJ Archive