Subdomains: subdomain Utility

The subdomain utility is used to manage subdomains through CLI. By using this utility, you can perform the following tasks:

Syntax

subdomain <command> <subdomain name> [

<option_1> [<param>]

[<option_2> [<param>]]

…[<option_N> [<param>]]

Example

The following command line creates subdomain subdom.example.com on domain example.com domain, sets the disk space quota for the subdomain to 1 GB, enables SSI and PHP and SSL support, and creates a separate FTP account with user login name subdomftp and password ftppass for the subdomain.

# ./subdomain --create subdomain -domain example.com -hard_quota 1G -ssi true -php true -ftp_user native -login subdomftp -passwd ftppass -ssl true

Commands

Command

Parameter

Description

Example

--create or -c

<subdomain name>

Creates a subdomain on the domain specified by the -domain option.

To create subdomain subdom on domain example.com:

# ./subdomain --create subdom -domain example.com

or

# ./subdomain -c subdom -domain example.com

--update or -u

<subdomain name>

Updates an existing subdomain on a domain specified by the -domain option.

To change the name of subdomain subdom.example.com to subdomnew.example.com:

# ./subdomain --update subdom -domain example.com -new_name subdomnew

or

# ./subdomain -u subdom -domain example.com -new_name subdomnew

--remove or -r

 

Removes one or more subdomains specified by the -subdomains option from a domain specified by the -domain option.

To remove subdomains subdom1.example.com and subdom2.example.com from domain example.com:

# ./subdomain --remove -subdomains subdom1,subdom2 -domain example.com

or

# ./subdomain -r -subdomains subdom1,subdom2 -domain example.com

--info or -i

 

Displays information about configurations of subdomains that exist on a specified domain.

By default, displays info on all subdomains on a domain. Use the -subdomains option, to display information only about subdomains specified by the option.

To display information about all subdomains on domain example.com:

# ./subdomain --info -domain example.com

or

# ./subdomain -i -domain example.com

--help or -h

 

Displays help on the use of the utility.

To see the help info on the use of this utility:

# ./subdomain -–help

or

# ./subdomain -h

Options

Option

Parameter

Description

Example

-domain or -d

<domain name>

Specifies the parent domain that the subdomain belongs to.

To create a subdomain on example.com:

# ./subdomain -c subdom -domain example.com

-new_name

<subdomain name>

Changes the name of a subdomain.

Used only with the --update command.

To change the name of subdomain subdom.example.com to subdomnew.example.com:

# ./subdomain -u subdom -domain example.com -new_name subdomnew

-ftp_user

native|main

Specifies the FTP account to be used on a subdomain. If set to native, specifies that the subdomain will use its own separate FTP user account (the FTP user parameter, the Create a separate FTP user account for this subdomain option); if set to main, specifies that the subdomain domain will use the the FTP user account of the parent domain (the FTP user parameter, the Use the FTP user account of the main domain option).

Set to main by default.

When used with the native argument, requires concomitant use of the -login option.

To set subdomain subdom.example.com to use a separate FTP account with FTP user login name ftplogin:

# ./subdomain -u subdom -domain example.com -ftp_user native -login ftplogin

-login

<login name>

Sets the user login name for subdomain's own separate FTP account (the FTP Login parameter). The login name can only be specified if the subdomain uses its own, separate FTP account.

To change the user login name for the separate FTP account on subdomain subdom.example.com to ftplogin:

# ./subdomain -u subdom -domain example.com -login ftplogin

-passwd

<password>

Sets the user password for subdomain's own separate FTP account (the Password parameter). The password can only be specified if the subdomain uses its own, separate FTP account.

See additional comments in the Note below the table.

To set the user password for the separate FTP account on subdomain subdom.example.com to ftppass:

# ./subdomain -u subdom -domain example.com -passwd ftppass

-passwd_type

plain|crypt

Specifies the type of the FTP user password - plain or cryptic. Is set to plain by default. The password type can only be specified if the subdomain uses its own, separate FTP account.

See additional comments in the Note below the table.

To set the type of the FTP user password to cryptic on subdomain subdom.example.com:

# ./subdomain -u subdom -domain example.com -passwd_type crypt

-hard_quota

<number>[K|M|G]

Sets the Hard disk quota limit for a subdomain. (type "0" to set the parameter to Unlimited).

Set to Unlimited by default.

The hard disk quota limit can only be set if the subdomain uses its own, separate FTP account.

To set the hard disk quota limit to 10 GB:

# ./subdomain -u subdom -domain example.com -ftp_user native -hard_quota 10G

-ssi

true|false

Enables or disables SSI support on a subdomain (the SSI support parameter).

Set to false by default.

To enable SSI support on subdomain subdom.example.com:

# ./subdomain -u subdom -domain example.com -ssi true

-php

true|false

Enables or disables PHP support on the subdomain (the PHP support parameter).

Set to false by default.

To enable PHP support on subdomain subdom.example.com:

# ./subdomain -u subdom -domain example.com -php true

-cgi

true|false

Enables or disables CGI support on a subdomain (the CGI support parameter).

Set to false by default.

To enable CGI support on subdomain subdom.example.com:

# ./subdomain -u subdom -domain example.com -cgi true

-fastcgi

true|false

Enables or disables FastCGI support on a subdomain (the mod_fcgid support parameter).

Set to false by default.

To enable FastCGI support on subdomain subdom.example.com:

# ./subdomain -u subdom -domain example.com -fastcgi true

-perl

true|false

Enables or disables Perl support on a subdomain (the mod_perl support parameter).

Set to false by default.

To enable Perl support on subdomain subdom.example.com:

# ./subdomain -u subdom -domain example.com -perl true

-asp

true|false

Enables or disables ASP support on a subdomain (the ASP support parameter).

Set to false by default.

To enable ASP support on subdomain subdom.example.com:

# ./subdomain -u subdom -domain example.com -asp true

-python

true|false

Enables or disables Python support on a subdomain (the mod_python support parameter).

Set to false by default.

To enable Python support on subdomain subdom.example.com:

./# ./subdomain -u subdom -domain example.com -python true

-coldfusion

true|false

Enables or disables ColdFusion support on a subdomain (the ColdFusion support support parameter).

Set to false by default.

To enable ColdFusion support on subdomain subdom.example.com:

# ./subdomain -u subdom -domain example.com -coldfusion true

-miva

true|false

Enables or disables Miva support on a subdomain.

Set to false by default.

To enable Miva support on subdomain subdom.example.com:

# ./subdomain -u subdom -domain example.com -miva true

-subdomains or -s

<subdomain name>[,<subdomain name>,...]>

Specifies the subdomains to remove or to display information about. Is used in combination with --remove and --info commands, respectively. If the --info command is used without the option, information about all subdomains existing on the parent domain will be displayed.

To remove subdomains subdom1.example.com and subdom2.example.com from domain example.com:

# ./subdomain --remove -subdomains subdom1,subdom2 -domain example.com

-ssl

true|false

Enables or disables SSL support on a subdomain domain.

Set to false by default.

To enable SSL support on subdomain subdom.example.com:

# ./subdomain -u subdom -domain example.com -ssl true

-same_ssl

true|false

Enables or disables using a single directory for storing content accessible through SSL and non-SSL connection (the Use a single directory for housing SSL and non-SSL content parameter).

Set to false by default.

To enable using a single directory for storing content accessible through SSL and non-SSL connection on subdomain subdom.example.com:

# ./subdomain -u subdom -domain example.com -same_ssl true

Note: Use of this option is not recommended. Passing passwords through CLI as parameters of the -passwd option may potentially compromise the system's security as command line can be observed by other users of the system. It is more secure to pass passwords through the environment variables. You can transfer non-encrypted passwords by using environment variable PSA_PASSWORD while using single quotes to specify the empty values in the command line for the argument of the -passwd - -passwd_type options.
Similarly, you can transfer encrypted passwords through the environment variable PSA_CRYPTED_PASSWORD while using single quotes to specify the empty values in the command line for the argument of the -passwd and -passwd_type options.