Saturday, 27 December 2025
  14 Replies
  456 Visits
1
Votes
Undo
Hello,

we are migrating from cPanel and stumbled upon this "inconvenient": by default a user can delete or change his main/default domain name in DA Domain management
interface.
We are also using WHMCS and the main domains in whmcs should match the main domain in DA panel.

How can we achieve this, or is this achievable:
1. the users can't delete or change the main/defaul domain name, but the reseller or admin should be able to do this
and
2. where allowed by the hosting plan, the users should be able to add/delete/modify only additional domains (but not the main one).

I tried different settings in directadmin.conf for "users_can_add_remove_domains" parameter but none was what i wanted.


Thanks.
1 month ago
·
#370
0
Votes
Undo
The one issue with the code in - /usr/local/directadmin/scripts/custom/domain_destroy_pre/default_domain.sh -

Code:

#!/bin/sh
if [ "$defaultdomain" = "yes" ]; then
echo "Cannot delete the default domain";
exit 1;
fi
exit 0;


Is that it will create issue if the account (i.e - the username) is deleted by the admin or reseller (I presume). The domain won't get fully deleted with this code present.

My solution to this was to modify the code slightly:

Code:

#!/bin/sh

if [ -z "${creator}" ]
then
if [ "$defaultdomain" = "yes" ]
then
echo "Cannot delete the default domain";
exit 1;
fi
exit 0;
fi


It would seem that the ${creator} environment variable is not present when the domain_destroy_pre hook is called from within a user's control panel. But it is present when deleted from the admin panel (or at least using the API). So you check for the existence of the ${creator} variable and if it's not found, then you check to make sure the domain name is not the default domain before exiting.
1 month ago
·
#369
0
Votes
Undo
The

/usr/local/directadmin/scripts/custom/domain_destroy_pre/default_domain.sh

Looks like it would accomplish what I need and this will work just fine.

I suppose to stray this a bit off-topic, but to my point about documentation... is there a list of all of the /usr/local/directadmin/scripts/custom available hooks? And then what environment variables are passed to each hook would also be beneficial. Is that information any where in any central location?
1 month ago
·
#368
0
Votes
Undo
For billing purposes use LOGIN instead of domain name. Users/resellers can't modify their logins.
1 month ago
·
#367
0
Votes
Undo
Stumbled across this today too.

... so I'm guessing this was never resolved?

There may be an option that disabled this. But trying to find the correct option to flag is really a tough exercise with DirectAdmin scattered documentation.
  • Page :
  • 1
  • 2
There are no replies made for this post yet.
Submit Your Response
© 2026 hostsocial.io