Template Variable Listing

This page lists many of the template variables that you can use in email messages to domain owners and mailboxes, initial website content, Apache and BIND configurations and many other places in Virtualmin. In all cases, variables like ${DOM} or $DOM will be replaced with the value from the domain or mailbox being created, such as foo.com. Additional variables can be found by looking in "/etc/webmin/virtual-server/domains/DOMAIN_ID". The parameters found in the files named "DOMAIN_ID" can all be used in the template variables.

Domain Template Variables

The following variables are available in any template related to a virtual server.

Variable Value Example
$DOM Domain name something.com
$IDNDOM Domain name in native character set 複写機.com
$USER Virtual server's administration login and Unix username something
$GROUP Unix group for mailboxes something
$PASS Password in plain text sekret
$IP IP address for virtual server 210.23.131.66
$IP6 IPv6 address for virtual server, if any fe80::fabc:12ff:fe51:64ce
$OWNER Virtual server description Some company's website
$EMAILTO Contact email address something@gmail.com
$HOME Home directory /home/something
$ID Unique ID for each domain 105919890014385
$PARENT Unique ID for the parent domain, if any 10545243545454
$UID Unix UID for virtual server's Unix user 501
$GID Unix GID for virtual server's Unix group 1001
$PREFIX Prefix or suffix for mailbox users something
$QUOTA Quota for Unix user and all mailboxes 100MB
$UQUOTA Quota for Unix user only 90MB
$BW_LIMIT Per-month bandwidth limit 1GB
$BW_USAGE Bandwidth used this month 745MB
$RESELLER Reseller's login name, if any scrooge
$DB Default database name scrooge
$MYSQL_USER Username for MySQL login scrooge
$MYSQL_PASS Password for MySQL login scrooge
$RESELLER_DESC Reseller's description, if any Scrooge McDuck
$DISABLED Set to a list of disabled services, if any web,dns,unix
$DISABLED_WHY The reason this virtual server was disabled, if so Non-payment of bills

In addition, any custom fields will be available in variables named $VIRTUALSERVER_FIELD_fieldname , where fieldname is the name of the custom field.

Domain Feature Variables

The follow variables are available in any virtual-server related template, and will be set to 1 if the feature they are related to is enabled, 0 if not. They are most useful in blocks like ${IF-DNS} ... ${ENDIF-DNS}.

Variable Related feature
$DIR Virtual server has a home directory (almost always true)
$UNIX Server has a Unix login (true for top-level servers, false otherwise)
$VIRT A non-shared IP address is associated with the virtual server
$WEB A website is enabled
$MAIL Email to the virtual server's domain is accepted
$SSL A website with SSL support is enabled
$DNS A DNS domain exists
$LOGROTATE Log rotation is enabled for web and FTP logs
$MYSQL The virtual server has a MySQL login and can have databases
$POSTGRES The virtual server has a PostgreSQL login
$WEBALIZER Reporting of web traffic by Webalizer is enabled
$FTP A virtual anonymous FTP site is enabled
$SPAM Spam filtering for email is enabled
$VIRUS Virus filtering is enabled
$STATUS Status monitoring of the virtual server's website is active

The following variables are similar, but are associated with plugin features :

Variable Related feature
$VIRTUALMIN-DAV DAV access to the virtual server's website is enabled
$VIRTUALMIN-SVN SVN access to any repositories is available
$VIRTUALMIN-MAILMAN Mailing lists can be associated with the virtual server
$VIRTUALMIN-AWSTATS AWstats reporting of web traffic is enabled
$VIRTUALMIN-GOOGLE-ANALYTICS Analytics tracking by automatic tag insertion is available
$VIRTUALMIN-REGISTRAR DNS domain registration has been done
$VIRTUALMIN-SLAVEDNS The DNS domain is a slave from a master hosted elsewhere
$VIRTUALMIN-MAILRELAY Email is relayed (possibly with filtering) to another mail server
$VIRTUALMIN-INIT The virtual server can have commands run at boot time

When the template is related to a sub-server, variables for the parent server are also available. These are the same as those for the actual server, but with PARENT_DOMAIN_ prefixed, like $PARENT_DOMAIN_HOME and $PARENT_DOMAIN_DOM.

Mailbox Variables

The following variables can be used in templates related to mailbox or FTP users, such as the email message sent when a mailbox is created :

Variable Value Example
$USER Full Unix username joe-something
$MAILBOX First part of the email address, before the @ joe
$PASS Encrypted password $1$43445435$dfsfaffsaffdsf
$PLAINPASS Plain-text password, when available sekret
$QUOTA Disk quota, nicely formatted 100Mb
$UQUOTA Disk space used, nicely formatted 51Mb
$EMAIL Full email address, if any joe@something.com
$EXTRA Additional email addresses, space-separate sales@something.com info@something.com
$HOME Home directory for the user /home/something/homes/joe
$REAL Real name of the user Joe Smith
$SHELL Unix shell the user has /bin/false
$UID Mailbox Unix user's UID 502
$GID Unix user's GID 1002
$SMTP_HOST Outgoing Mail Server Name something.com
$IMAP_HOST POP3/IMAP Server Name mail.something.com
$FTP Set to 1 if the user has FTP access, 0 if not 1
$SSH Set to 1 if has SSH access, 0 if not 0

Variables In Domain Modification Scripts

If you have configured Virtualmin to run a script before or after a virtual server is modified, all of the variables listed on this page are available in Unix environment variables. However, they are prefixed with VIRTUALSERVER_ , such as $VIRTUALSERVER_DOM for the domain name. Also, any dashes are replaced with _ , so the variable to check for the AWstats plugin would be $VIRTUALMIN_AWSTATS

You could use them in a script like so :

#!/bin/sh
if [ "$VIRTUALSERVER_ACTION" = "CREATE_DOMAIN" ]; then
  echo Virtual server $VIRTUALSERVER_DOM has been created >>/var/log/virtualmin
fi

The $VIRTUALSERVER_ACTION variable can have one of the following values :

Value Meaning
CREATE_DOMAIN Set when a virtual server is being created.
DELETE_DOMAIN Set when a virtual server is being deleted.
MODIFY_DOMAIN Set when a virtual server is being changed, such as getting a new password, features or quota.
DISABLE_DOMAIN Set when a virtual server is being disabled via the UI or for exceeding its bandwidth limit.
ENABLE_DOMAIN Set when a virtual server is being enabled via the UI or for dropping back under its bandwidth limit.
RESTORE_DOMAIN Set when a virtual server is being restored from a backup.