Existing email accounts


What’s the best way of getting Virtualmin to manage existing email accounts?

I have a couple of hundred accounts already being used before Virtualmin was installed, manually managed on the command line. The only migration process I can think of at the moment is to
[li]shut down the mail servers[/li]
[li]back up all mail folders and passwords from /etc/shadow[/li]
[li]delete the original accounts[/li]
[li]batch create new accounts in Virtualmin with the same usernames (turn off suffixing of domain to username)[/li]
[li]reassign passwords from the saved /etc/shadow[/li]
[li]restore mail content into Maildirs in each home directory[/li]
[li]restart everything[/li]

Any thoughts or alternatives?

Oliver<br><br>Post edited by: okohll, at: 2008/07/26 00:35

Since no one’s commented, I’ll try this out in a couple of days, maybe on my own account first.

So if anyone sees a great big problem please speak up now!


Sorry for the slow reply, Oliver.

Your process is a pretty good one.

Mailboxes are tricky…we can import virtual hosts, which creates a new Webmin user and brings things under control. But mail users, unless they are already setup in the way Virtualmin expects them to be, won’t be recognized as associated with a particular virtual server.

So, let me explain how Virtualmin manages users and membership in a “virtual server”, and that might provide a little more guidance (and let you know if there might be a non-disruptive way to do what you’re after).

When you create a new virtual server, Virtualmin creates a user and a group for that virtual server.

Each new mailbox user will be a member of the virtual server group–this is how Virtualmin knows the user "belongs to" a particular virtual server, and it also conveniently fits into the UNIX permissions model in a nice way.

So, if your users all belong to a single group matching the virtual server they will “belong to”, everything will probably just fall into place when you import the virtual server(s) into Virtualmin. Home directories will be wrong, though, now that I think of it, and permissions won’t be quite so natural. So maybe batch creation is still the right way to go here.

But, if that’s not the case…a batch creation is almost certainly the best way to go.

Oh, yeah, Virtualmin won’t break existing mail–unless/until you turn on mail for a domain that already has service, Virtualmin can coexist with existing mail accounts, and won’t cause them to stop working.


Thanks, that’s very helpful.

As a test, I modified the primary group for a user (my own) to be that for the virtual server and everything does seem to fall into place. I found it’s got to be the primary group (usermod -g groupname username) rather than just adding an additional group (usermod -G groupname username).

The user home directory is outside of the virtual server home directory but everything still seems to work. If there are any problems caused by this, moving the home directory shouldn’t be an issue. I’ll look out for any permission issues as well but this does seem to be a less disruptive way of doing it.


The user home directory is outside of the virtual server home directory but everything still seems to work.

Check to be sure virtual server backups actually get those directories…if so, then you’re probably fine.