25.1. The Custom Commands Module

Most system administrators like to create shell scripts to perform common tasks, such as backing up a database or adding a new user of some kind. Because every system and organization is different, there will always be tasks that a generalized tool like Webmin cannot do as easily as a simple, customized script. Unfortunately, scripts run at the command line are not easy for an inexperienced user to use.

The Custom Commands module allows you to create simple web interfaces for shell scripts and commands so they can be run from within Webmin at the click of a button. It also allows you to define the parameters of various types for each command that can be entered by the user and substituted into the shell command. This can be used to provide additional arguments or input to the scripts that are run, depending on selections made by the user before running it.

Another feature of the module is the ability to define file editors so frequently changed files can be edited through Webmin's web interface. You can also define commands to be run before and after the file is edited so it can be validated, copied, or backed up before editing.

Possibly the most useful feature of the module is its access control support. You can grant other Webmin users the rights to use some or all of the commands and editors, while giving only yourself and other trusted administrators permissions to create and edit commands. This means that the other users can only execute the scripts and edit the files that you allow them to, but with full root privileges.

Unlike most other modules, this one does not deal with the configuration of some separate server or service, therefore it has the exact same user interface and functionality on all versions of UNIX on which Webmin can run.

When you enter the module from the Others category, its main page shows all existing custom commands and file editors, along with their parameters. Figure 25.1 shows an example from a system with one file editor and eight commands defined—two of which have a parameter. If you have not used the module before, however, the page will be empty.

Figure 25.1. The Custom Commands module.


You can run any command shown on the main page by just clicking its button. If the command has parameters fields or choices, however, you must fill them in or make the appropriate selections before running it. When the button is clicked, you will be taken to a page showing all output from the command so you can see if it succeeded or failed.

To use a file editor, just click on its button on the main page. This will take you to an editing form showing the current file contents, which you can change freely. When done, click the Save button below the text box to write out the new file contents.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.39.59