Can't add domain name

boredtechie

Verified User
Joined
Apr 6, 2022
Messages
25
Hello,
My website is a MAINDOMAIN.com
My server is SERVER.MAINDOMAIN.com

My admin account doesn't have any domain names. I want to associate it with MAINDOMAIN.com. However, when I try to add MAINDOMAIN.com it says "Already Exists"

I went to DNS Administration and MYDOMAIN is there. How do I get that associated with my admin account?
 
Or you can just move the domain to admin via SSH.

Code:
cd /usr/local/directadmin/scripts
./move_domain.sh domain.com olduser newuser
where newuser is admin and olduser is the accountname of the current user.
 
you can remove domain from DNS administration and re-add as admin
I can't do that from the GUI. It won't delete all the nameservers.

Or you can just move the domain to admin via SSH.

Code:
cd /usr/local/directadmin/scripts
./move_domain.sh domain.com olduser newuser
where newuser is admin and olduser is the accountname of the current user.
I'm not sure it's actually attached to a user. How would I tell? It just seems to be glitched in limbo.
 
How would I tell?
You could check as admin with "list users" and see where the domain resides. If it's not connected to any user then it was probably added via DNS Administration and you can remove it from there like @Zhenyapan said.

However if it does not delete nameservers from there it might be somewhere else.
 
Older post but many people got same errors so.. ..save code below as domain_exists_fix.sh in /usr/local/directadmin/scripts/custom to fix the "Already Exists" message, manually running with "bash domain_exists_fix.sh username domain.tld"

Code:
#!/bin/sh

if [ -z "${user}" ]; then
        user=$1
fi
[ -z "${user}" ] && echo "Missing username!" >&2 && exit 1
if [ -z "${domain}" ]; then
        domain=$2
fi
[ -z "${domain}" ] && echo "Missing domainname!" >&2 && exit 1

rm -rf /home/${user}/domains/${domain}
rm -rf /home/${user}/imap/${domain}

grep -v '${domain}' /etc/named.conf > /etc/virtual/temp && mv -f /etc/virtual/temp /etc/named.conf
rm -f /var/named/${domain}.db
rm -f /var/named/${domain}.db.signed
rm -f /var/named/${domain}.ksk.*
rm -f /var/named/${domain}.zsk.*
rm -f /var/named/dsset-${domain}.
rm -f /var/named/dlvset-${domain}.

grep -v '${domain}' /etc/virtual/domains > /etc/virtual/temp && mv -f /etc/virtual/temp /etc/virtual/domains
grep -v '${domain}' /etc/virtual/domainowners > /etc/virtual/temp && mv -f /etc/virtual/temp /etc/virtual/domainowners
rm -rf /etc/virtual/${domain}

rm -f /usr/local/directadmin/data/users/${user}/domains/${domain}.*

exit 0;
 
Back
Top