Wednesday, March 19, 2008

Moving Domains between Users

Although moving domains between users is not a feature in DirectAdmin and is not officially supported, it is still possible to do.

1) Create the new user to recieve the domain. When entering a domain, enter a domain of a different name, as in "domain.com2" instead of "domain.com". DA won't let you add the same name twice, which is why we use a different one for the time being. Doing this will setup all the required files/paths needed to use the website.

2) Move the data to the new domain.

cp -pR /home/olduser/domains/domain.com/* /home/newuser/domains/domain.com2/
chown -R newuser:newuser /home/newuser/domains/domain.com2

3) Email data is fairly simple.. instead of moving data around like in step 2, we only need to rename a few directories.

cd /etc/virtual
mv domain.com domain.com.tmp
mv domain.com2 domain.com
mv domain.com.tmp domain.com2

So that the data we want will be currently set to be under domain.com2. There are other email data files that would need to be moved as well. Any data in /home/olduser/imap would need to be copied over. There will also be permission issues as well, but we can fix that afterwards with the set_permission.sh script.

4) Once everything is more or less setup under the domain.com2, then we can go ahead and do the domain renaming. Login to DA as olduser. Go to User Level -> Domain Setup -> Change a Domain Name. Select domain.com rename it to domain.com.old. Logout, and login as newuser. Go to the same area and rename domain.com2 to domain.com.

This should do most of the work for you. There are other things like databases and cronjobs that are not domain specific, so they'd need to be copied over as needed.

No comments: