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,

Christian

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”?

Howdy,

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.

-Eric

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 …

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,

Christian

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

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

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

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,

Christian

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.

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

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,

Christian