Creating Usermin Modules
Usermin has a very similar architecture to Webmin, and so its modules have an almost identical design to Webmin modules. The main difference is that Usermin is designed to be used by any Unix user on a server to perform tasks that they could perform from the command line. Any third-party Usermin modules should be written with this in mind.By default, module CGI programs are run as root, just like in Webmin. This is necessary because some tasks (like changing passwords) can only be done as root. However, most Usermin modules do not need superuser privileges and so should call the standard switch_to_remote_user function just after calling init_config , in order to lower privileges to those of the logged-in user.
Usermin module can have global configuration variables that are initially set from the config or config-ostype file in the module directory, and are available in %config. However, these variables are never editable by the user - they can only be set in the Usermin Configuration module of Webmin.
Per-user configurable options are supported though, using a different mechanism. When the standard create_user_config_dirs function is called, the global hash %userconfig will be filled with values from the following sources, with later sources overriding earlier ones :
- The defaultuconfig file in the module directory
This should contain the default options for this module for all users, to be used if no other settings are made by the user or sysadmin. - The file /etc/webmin/modulename/defaultuconfig
This contains defaults for the module on this system, as set by the sysadmin using the second part of the 'Usermin Module Configuration' feature in the 'Usermin Configuration' Webmin module. - The file ~username/.usermin/modulename/config
This contains options chosen by users themselves.
If you create your own Usermin module, it should be packaged in exactly the same way as a Webmin module (as a .tar or .tar.gz file). However, the module.info file must contain the line usermin=1 so that it cannot be installed into Webmin where it would not work properly.

