Article
Use Webmin for Linux Administration, Parts 1 and 2
Part 2
Webmin serves as a powerful graphical user interface for root access, configuration and management of *Nix servers. As we discussed in Part 1 of this series, Webmin can be very useful to the Web developer who needs to manage sysadmin tasks such as setting up domains and providing clients limited access to server(s) on demand.
In this follow up, we will dig down into several areas of system administration, including the use of Webmin during server migration, and fine-tuning the control you have over your systems security and resources. We'll also discuss some additional tips and techniques for getting the most out of Webmin.
Working with Your Server
Tuning Your Web Server
One of the benefits of using a graphical interface to administer a system is efficiency. However, one pitfall that's often cited is the disconnection between the GUI (graphical user interface) and the underlying configuration files and root-level access.
When logging into Webmin as root, you enjoy the best of both worlds. As a real world example, let's look at tuning your server for optimized performance. Obviously, the initial build of your machine is the first key to tuning a Web server. However, it may well be that you're using a dedicated server that was built and deployed on your behalf, without intervention on your part. In this case, unnecessary services may be running on the server that may chip away at memory and processor resources.
Upon logging into Webmin, and selecting the System icon, you'll see a Bootup and Shutdown menu. Within this section, you can review all the services known to be installed on your server that may be slated for start at boot. By going one click further and selecting one of the services listed, you'll realize just how granular is the control within Webmin. Under each item in the Bootup and Shutdown menu, you're given root-level control over the option to start when the server boots, as well as complete control over the startup script for each service.
Select only those services that are needed to ensure your Web server runs properly, and you'll free up additional system resources -- and, possibly, improve the overall performance of the system. For example, turning off the daemons for printing, Samba, and NFS, which may not be relevant to your web hosting needs, will reduce the number of services that run while your server is in production.
Adding New Modules to Webmin
Aside from the default modules included with your Webmin installation, there are numerous third-party modules available to accommodate custom applications and services on Linux servers.
These module add-ons can be found here at Sourceforge; these include more than 270 modules and numerous themes.
Once you have downloaded a new module as a .wbm file, click on the Webmin icon, and Webmin Configuration to access Webmin Modules. Then, use the form at the top of the page to install the module either from the local filesystem of the server on which Webmin is running, or uploaded from the client on which your browser runs.
If you absolutely cannot find a module that meets your needs, you can either build your own module, or, you can contract custom development directly from the Webmin group.
Time and Date on Your Server
A neat little time and date utility allows you to ensure that your hardware and system time are synchronized on your server. It also provides you the ability to add a Network Time Server -- a known, accurate source for time to which you can synch your system.
Setting this up is easy -- access the Hardware icon and select System Time. The menu is self-explanatory. The time server can be entered as an IP address or a fully-qualified domain name.
Perl Modules
The addition of new features or functionality to your server will frequently involve the application of a Perl module that's not included in the standard Perl install. Through Webmin's Others icon, you can access a Perl Modules option. This not only allows you to see the non-standard modules that are already on your system, it also lets you:
- Search and install modules from CPAN.org
- Install a module from a remote url
- Upload and install a module
- Install a module that resides on the system
Multiple IPs on Your Server
The Network icon gives you powerful control over the local and wide area networking capabilities your server may provide. This icon allows you to control the Linux firewall (iptables) as well as the options for DSL, VPNs, and working with your ethernet configuration.
Under Network Configuration, you can add virtual interfaces to the primary IP on your system. This is useful if you have hosts on independent IP addresses (perhaps they're using anonymous FTP or SSL). Adding the TCP/IP configuration is easy -- click on Network Configuration, then Network Interfaces. Click on Add an Interface and fill in the form provided. Remember that virtual interfaces are built from your primary physical interface (generally eth0), so this first, new virtual interface will be named eth0:1. Be sure you have the correct IP, subnet mask, and broadcast address before you proceed.
Webmin can restart your network services gracefully and initialize the new interface immediately.
Managing Cron
A powerful tool that's simplified within Webmin is the management of cron. Cron is an automation daemon that can run commands, scripts, and programs at slated times. Under the System icon, within Scheduled Cron Jobs, you can administer cron jobs, create and delete cron tasks, and control user-level access to cron.
Spam Assassin and Procmail
If you're using either of these tools on your server, Webmin again provides control over your spam and general mail filtering facilities with gui-based access to administration.
More information on Spam Assassin is available here.
Procmail, as you may already know, is a mail processing tool that can filter mail based on the sender, subject line, the length of the message, the keywords in the message, etc. More information on procmail can be found at its official home page.
Working with Users on Your Server
Multiple Administrators & Logging Webmin Activity
Those with multiple servers or multiple administrators will gain real benefit from some of the useful features that log the actions carried out in Webmin, and the ability to set up administrators with limited rights with Webmin's configuration.
By default, basic logging is enabled in Webmin. To modify logging options, go to the Webmin icon and the Webmin Configuration module. Select Logging and turn on the "Log changes made to files by each action" option. By enabling detailed logging, you will be able to review each and every action you take on the system via the Webmin Actions Log module.
The Webmin Users option located under the Webmin icon allows you to allocate individual Webmin users specific module rights. For instance, you might set up a Webmaster with Apache, FTP, Sendmail and System Logs access, leaving the remainder of Webmin's modules available to the Systems Administrator.
Webmin also gives you the option to synchronize all *Nix users on the system. In the event that you take this option, I'd recommend that you specify Webmin groups -- this will allow you to establish permissions for various types of users, from end-users, to administrators, to root-access users.
Adding Multiple Users and Groups
In Part 1 of Administering Linux with Webmin (link to first article) we covered the manual addition of a user as part of the process of adding a domain. Here, I want to discuss a tip for adding, editing, or deleting in bulk through the Webmin interface.
Click on the System icon, then select Users and Groups, and you'll be presented with the option to batch process your users. These instructions are also found on the batch user-processing page within Webmin.
This form allows you to create, modify or delete multiple users simultaneously from an uploaded or local text file. Each line in the file specifies a single action, depending on its first field. The line formats are as follows:
create:username:passwd:uid:gid:realname:homedir:shell:min:max:warn:inactive:expire
modify:oldusername:username:passwd:uid:gid:realname:homedir:shell:min:max:warn:inactive:expire
delete:username
If the uid field is left empty in create lines, Webmin will assign a UID automatically. If the gid field is empty, Webmin will create a new group that has the same name as the user. The username, homedir and shell fields must be supplied for every user, but all other fields are allowed to be empty. If the passwd field is blank, no password will be assigned to the user. If it contains just the letter x, the account will be locked. Otherwise, the text in the field will be taken as the cleartext password and encrypted.
In modify lines, an empty field is taken to mean that the corresponding user attribute is not to be modified.
Generating SSH Keys for Users
If your server is used for or allows shell accounts, you may find this little feature within the Servers icon under SSH Server helpful.
As you may already know, enabling ssh access without the requisite password interaction requires the generation of an ssh key. This key enables the secure handshake between client and server to occur automatically, and is particularly helpful if you have shell accounts that need to drop data files to your server on a fixed schedule.
This configuration page allows you to configure the automatic setup of SSH for new users who are added to your server. Once it's configured, new users will not have to run ssh-keygen before they use SSH.
Synching Users and MySQL Users
If you provide MySQL databases for each domain or user who's added to your system(s), you might make use of an easy-to-use feature under the Servers icon and MySQL Database Server that enables you to set up user synchronization.
Under User Permissions, you can configure Webmin to generate MySQL users with specific database and host permissions automatically as users are created in Webmin under System: Users and Groups (adding Linux users to the system).
Exploring Webmin Further
As we have seen in this two-part series, Webmin is a powerful Linux administration tool. To learn more about Webmin, you can, of course, read through the Webmin site at www.webmin.com. Here are some additional links you may want to visit as well:
The Book of Webmin
Joe Cooper has written an in-depth guide to using Webmin that's appropriately named the Book of Webmin, and is available here. You'll also find a link to a PDF download with Webmin information there.
Webmin Mailing Lists
There are several Webmin mailing lists available to users, including announcements, developers and more. Stop by Webmin.com. Also see the Webmin Forums at http://webmin.us/phpBB2.