Command Line API

Introduction

Using the command-line scripts included with Virtualmin to manage users, aliases, servers, databases and resellers.

Virtualmin includes a script named virtualmin that can be run from the Unix shell to perform actions that are usually done from the web interface. In fact, almost all actions that can be done in a browser can also be done from the command line, or from shell scripts. This allows virtual server, user and alias creation and management to be done in a more automated function, such as from programs or scripts of your own creation.

The first parameter to the virtualmin command is the operation you want to perform, such as create-domain. Depending on the operation, additional parameters may be needed, such as the name of the domain to create, password and so on. In almost all cases the parameters are given like --domain foo.com.

The virtualmin command must be run as root, as it needs access to system configuration files to create users, set up web sites and so on. If you want to create servers, users and aliases programatically as a different user (such as from your own CGI scripts), see the documentation on the Virtualmin Remote API instead.

All of the operations that make changes to the system output messages indicating their success or failure. Their exit status can also be checked to determine success - an exit status of 0 indicates that everything went OK, while a non-zero status indicates some problem.

All operations can be called with the --help command-line parameter to have them output details of the required and allowed parameters. Alternately, you can run virtualmin help to get a list of all available commands, or virtualmin help command to get information on what a particular command does.

Command Categories