Disable select service subdomains

cPanel & WHM Version
WHM v90.0.5

LotusBlossom

Member
Dec 20, 2019
8
2
3
California
cPanel Access Level
Root Administrator
I have been researching all over these forums and I have read the Service Subdomains Explanation documentation but I still cannot figure out how to disable select service subdomains from being auto created every time I create a new subdomain. I am trying to disable the creation of whm, webdisk, cpcontacts, and cpcalendars from being auto created. I have followed the instructions to Edit Zone Templates but my simple, standard, and standardvirtualftp templates do not mention any of the service subdomains I am trying to disable, they only seem to contain the setup for mail, www, and ftp.

Secondly is there an easy way to remove the mentioned subdomains in one action across all domains within my WHM? I have tried running the safe removal script mentioned by cPanelMichael in this thread What are cpcalendars, cpcontacts, and webdisk, but that only seems to allow removal from one domain at a time and is very slow to do so.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,274
1,296
313
Houston
Hello,


You can disable service subdomains on existing domains by running the following via SSH:
Code:
/scripts/servicedomains remove
To keep them from being created on new accounts you can go to WHM>>Server Configuration>>Tweak Settings and select "Off" for Service subdomains.
 

LotusBlossom

Member
Dec 20, 2019
8
2
3
California
cPanel Access Level
Root Administrator
Thank you for the help Lauren. I am trying to turn off only the automatic creation of dns records for whm, webdisk, cpcontacts, and cpcalendars from being created. I don't want to disable the setting for "Service subdomains" as that completely disables the use of cpanel.example.com and webmail.example.com which my clients use regularly.

Also, I want to disable the automatic creation of "Service subdomains" DNS records for newly made subdomains, I have no need for them. But I need to retain the service subdomains of cpanel and webmail for the main domains. Is that possible?
 
Last edited:

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,274
1,296
313
Houston
So turning service subdomains off will keep them from being autocreated and also remove them from existing domains. The fix for that being, you can run the /scripts/servicedomains script from the command line to add servicedomains to accounts you would like them on individually with the service domains setting off.
 

Whitebeard

Registered
Nov 22, 2020
1
0
1
NL
cPanel Access Level
Root Administrator
When you create a subdomain this way, it will be populated to the internal DNS server, but it won't show up under AutoSSL.
The option Service Subdomains under Tweak Settings create all the service subdomains, even the ones I don't want to be created. CPanel and webmail are highly appreciated though. Of course I can create subdomains under domain settings (domainfqdn/cpanel or domainfqdn/webmail) but they will register as a seperate domain for AutoSSL and thus won't be covered by the domain certificate.
 
Dec 27, 2019
10
0
1
doubai
cPanel Access Level
Root Administrator
I want to disable "Service subdomains" option of tweak settings from command line. when i run both bellow command.

# /scripts/servicedomains remove --ifenabled
Removing service subdomains for all users.
This may take several minutes if there are many accounts on the system.


# /scripts/servicedomains remove
Removing service subdomains for all users.
This may take several minutes if there are many accounts on the system.


how can i disable or remove Service subdomains from command line
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
12,499
1,971
363
cPanel Access Level
Root Administrator
@aria_opensource - if you run the command without any options you'll see the help file, and that explains what flags are available for the /scripts/servicedomains command:

Code:
[[email protected] /]# /scripts/servicedomains
Usage:
    servicedomains [action] [options]

        Options:
          --help                          Brief help message
          --man                           Full help message
          --user=                         User to configure
          --domain=                       Domain to configure
          --subdomain=                    Service subdomain to manipulate
          --no_replace=0                  Enable replacment of existing records (currently
                                          only used for changing autodiscover hosts)
          --old_autodiscover_host=        The previously configured autodiscover host (used
                                          for matching old records and updating them to the
                                          new host)
          --force_autodiscover_support=1  Behave as if the autodiscover support has not been
                                          disabled even if it has. This is useful for
                                          removing the autodiscovery service subdomains after
                                          the support for them has been disabled.
          --ifenabled                     Only perform the operation if service subdomains
                                          are enabled.

        Actions:
          add          Create service subdomains
          remove       Remove service subdomains