What's the best way to safely migrate accounts from domain A to domain B?

12 posts / 0 new
Last post
#1 Mon, 01/03/2011 - 04:46

What's the best way to safely migrate accounts from domain A to domain B?

The subject says it all.

A customer will change his domain name, 60+ accounts need to be migrated along with their mails, passwords and system settings (like forwarders). Any help is appreciated. Kind regards,


Mon, 01/03/2011 - 06:38

Can you give more information on this? What are you referring to with "accounts" exactly? What do the existing email addresses look like? How it Virtualmin configured in terms of "email address pre/postfix"?

Mon, 01/03/2011 - 08:27


Does "Domain B" already exist?

If not, an easy option is to just rename the domain (in Server Configuration -> Change Domain Name).

Outside of that, I don't believe Virtualmin has a method of moving Email/FTP accounts from one domain to another. Those accounts are associated with the domain in question.


Mon, 01/03/2011 - 10:08
ronald's picture

I thought one could change the domainname from within virtualmin at virtualmin - Server Configuration - Change domain name.
I believe this will change the email/ftp accounts (as in domain users) as well.
Best is to create a sample domain and change it just to test ...

Mon, 01/03/2011 - 13:52

Thank you all.

I'd like to create a fresh domain B and allow DNS services to sync between servers while the old domain is still in place. That's why I didn't like the idea of simply renaming domain A to B.

By "moving accounts" I'm thinking of all data that belongs to user John Doe with username john.doe.domain_a.com: Password, emails, aliases, quotas, forwarders, spam filter settings, extra permissions and such. In the end all should have been moved/copied to john.doe.domain_b.com

Could a backup/restore help? Kind regards,


Mon, 01/03/2011 - 14:44
ronald's picture

You could do a backup and then restore on the other server, then when dns has propagated, rename the domain.

Tue, 01/04/2011 - 03:57

Wait, are you actually moving the domain to another physical server, or are you just renaming it in place?

Tue, 01/04/2011 - 10:49
ronald's picture

as far as I can tell the OP is not moving to another physical server.
However the question is vague enough to add a possible method as he mentioned backup/restore

renaming would still be the best option imo. I also had to do this a few times

Thu, 01/06/2011 - 03:29 (Reply to #8)

Sorry if my original question was vague, I didn't meant it to be unclear.

My customer is changing the company name, and along his domain name. While the old name is a.com, the new will be b.com.

Doing so for 60+ employees who need to adjust their email clients isn't easily done. In particular, I still need the old a.com around as an alias to the newly created b.com, forwarding emails for some weeks after the change.

The transition begins with moving the domain registration, therefore I had to create a new, empty domain b.com to set up DNS.

Over the weekend I'll have to migrate accounts from a.com to b.com, keeping their passwords.

(1) Is there a way to export all user details (name, password, email aliases) as a plain text file suitable for batch-importing it into the new domain? I could use a text editor to exchange the old domain name for the new.

Maildirs within domain/homes belong to their respective user, who has the domain name as a suffix. Given a file containing all user names, I could have a little script rsyncing data from old to new and adjusting the permissions afterwards.

When I'm done moving maildirs, I'll remove the original a.com domain and re-create it as an alias of b.com

Kind regards,


Thu, 01/06/2011 - 06:24

I'd still recommend to simply use the "Change Domain Name" feature, after deleting the temporary "b.com", and renaming "a.com" to "b.com". Depending on how you set up the "composition" of email addresses, they will automatically get changed to the new name then.

Then you re-create "a.com" as an alias domain for "b.com", and all email addresses @b.com will be reachable @a.com too.

Thu, 01/06/2011 - 06:26 (Reply to #10)

Fair enough, I think I'll head that way. Thanks for your help.

Mon, 01/17/2011 - 00:57

For the record: That's how I did it.

  • Created a new domain b.com to allow DNS servers to spread the information.
  • After a few days, deleted that b.com, renamed a.com to b.com and added a.com as an alias.

Worked pretty seamlessly. Thanks all,


Topic locked