How to prevent users from creating certain domains – WHM/cPanel

The control panel WHM & cPanel allows you to prevent cPanel users from creating certain domains. Which means, to prevent users to create well-known common domains as PARKED or ADDON to the existing account. It’s a serious issue by considering the Spamming or other related suspicious activities which are usual in shared hosting accounts.

Consider one case, if you have a shared hosting account and one of your cPanel user may be using his account to send Spam emails or for other malicious activities from his parked or addon domain with the actual account. In this case, you must have an idea to prevent this from well-known and common domains such as facebook.com, google.com, gmail.com etc. You can prevent this from the Tweak settings of your WHM control panel.

By-default the WHM/cPanel blocks a list of domains, to see the domains WHM already blocks, view the file /usr/local/cpanel/etc/commondomains.

Example:

root@server [~]# cat /usr/local/cpanel/etc/commondomains
google.com
gmail.com
hotmail.com
aol.com
yahoo.com
excite.com
cs.com
juno.com
mail.com
email.com
address.com
altavista.net
netscape.net
netscape.com
earthlink.net
attracta.com

Steps to prevent user’s from creating certain domains

Step I : SSH to server as root.
Step II : Create the file /var/cpanel/commondomains.
In /var/cpanel/commondomains, list the domains you wish to prevent cPanel users from creating.
You must separate domains with a newline.

Important: You should only list domain names in /usr/local/cpanel/etc/commondomains (e.g. example.com). Listing a domain name will automatically prevent the creation of subdomains for the specified domain. For example, listing example.com will prevent users from creating sub.example.com. In addition, domains listed in this file should not contain a leading dot.

Step III : Make sure that, on the Tweak Settings screen, Prevent cPanel users from creating specific domains is turned ON.

See the attached image for more clarification.

Capture

That’s it!

Related Links
1, Simple steps to install CloudFlare plugin on cPanel server
2, How to prevent accessing accounts with server IP address(or hostname) and the account username in a cPanel server : ip/~username
3, How to find the total number of connections for a cPanel domain from the log files – command-line(SSH) option
4, How to enable BoxTrapper function for cPanel accounts – WHM/cPanel

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

Leave a Reply

Your email address will not be published. Required fields are marked *