Subdomains: subdomain Utility

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

Usage

subdomain <command> <subdomain_name> [
<option_1> [<param>]
[<option_2> [<param>]]
… [<option_N> [<param>]]

Example

The following command creates subdomain sample.example.com on the domain example.com, 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 john and password sample for the subdomain.

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

Commands

Command

Parameter

Description

Example

--create or -c

<subdomain_name>

Creates a subdomain on a specified domain.

Required -domain option.

To create the subdomain sample on the domain example.com:

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

or

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

--update or -u

<subdomain_name>

Updates an existing subdomain.

Required -domain option.

To rename the subdomain from sample.example.com to forum.example.com:

# ./subdomain --update sample -domain example.com -new_name forum

or

# ./subdomain -u sample -domain example.com -new_name forum

--remove or -r

 

Removes one or more specified subdomains from a specified domain.

Required -domain and -subdomain options.

To remove subdomains sample.example.com and forum.example.com from the domain example.com:

# ./subdomain --remove -subdomains sample,forum -domain example.com

or

# ./subdomain -r -subdomains sample,forum -domain example.com

--info or -i

 

Displays information on configuration of one or more specified subdomains.

If no subdomain is specified, displays info about all subdomains on a domain.

Required -domain option.

To view information about all subdomains on the 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 view 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 to which the subdomain belongs.

To create a subdomain on example.com:

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

-new_name

<subdomain_name>

Renames a subdomain.

Used with the --update command only.

To rename the subdomain from sample.example.com to forum.example.com:

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

-ftp_user

native|main

Specifies the FTP account to be used on a subdomain. The following modes are available:

  • native - specifies that the subdomain will use its own separate FTP user account;
  • main - specifies that the subdomain will use the FTP user account of the parent domain.

Is main by default.

When used with the native parameter, requires the -login option.

To set sample.example.com to use a separate FTP account with FTP user login name john:

# ./subdomain -u sample -domain example.com -ftp_user native -login john

-login

<login_name>

Sets the user login name for subdomain own separate FTP account.

Used when the -ftp_user option is set to native only.

To set the user login name for the separate FTP account on subdomain sample.example.com to jane:

# ./subdomain -u sample -domain example.com -login jane

-passwd

<password>

Sets the user password for subdomain own separate FTP account.

Used, when the -ftp_user option is set to native only.

See additional comments in the Note below the table.

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

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

-passwd_type

plain|encrypted

Specifies the type of the FTP user password.

Is plain by default.

Used, when the -ftp_user option is set to native only.

See additional comments in the Note below the table.

To set the type of the FTP user password on sample.example.com to encrypted:

# ./subdomain -u sample -domain example.com -passwd_type encrypted

-hard_quota

<number>[K|M|G]

Limits hard disk quota.

Unlimited if set to 0.

Is 0 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 for forum.example.com to 10 GB:

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

-ssi

true|false

Enables/Disables SSI support.

Is false by default.

To enable SSI support on the subdomain forum.example.com:

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

-php

true|false

Enables/Disables PHP support.

Is false by default.

To enable PHP support on the subdomain sample.example.com:

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

-cgi

true|false

Enables/Disables CGI support.

Is false by default.

To enable CGI support on the subdomain sample.example.com:

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

-fastcgi

true|false

Enables/Disables FastCGI support.

Is false by default.

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

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

-perl

true|false

Enables/Disables Perl support.

Is false by default.

To enable Perl support on the subdomain sample.example.com:

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

-asp

true|false

Enables/Disables ASP support.

Is false by default.

To enable ASP support on the subdomain sample.example.com:

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

-python

true|false

Enables/Disables Python support.

Is false by default.

To enable Python support on the subdomain sample.example.com:

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

-coldfusion

true|false

Enables/Disables ColdFusion support.

Is false by default.

To enable ColdFusion support on the subdomain sample.example.com:

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

-miva

true|false

Enables/Disables Miva support.

Is false by default.

To enable Miva support on the subdomain sample.example.com:

# ./subdomain -u sample -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.

To remove subdomains sample.example.com and forum.example.com from the domain example.com:

# ./subdomain --remove -subdomains sample,forum -domain example.com

-ssl

true|false

Enables/Disables SSL support.

Set to false by default.

To enable SSL support on the subdomain sample.example.com:

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

-same_ssl

true|false

Enables/Disables using a single directory for storing content accessible through SSL and non-SSL connection.

Is false by default.

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

# ./subdomain -u sample -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.