Migrating email with different account name format

troy.gerrie

Member
Jan 23, 2013
5
0
1
cPanel Access Level
Root Administrator
Hello,

We are currently in the final stage of preparing our own in-house hosting service to move ~200 websites and ~400 mailboxes currently hosted with another provider in a custom made hosting services into our cPanel installation.
We plan on migrating the mail with minimal interruption to the end users, we don't want have to reconfigure 400 mail clients remotely, this would be an enormous task.

The mail itself and passwords I am able to migrate just fine, the issue resides in the fact their current login usernames are setup as <username>_xx e.g. customer_01. Whereas cPanel uses different usernames to accomplish the same task. Does anyone have a solution for this?
 

Infopro

Well-Known Member
May 20, 2003
17,113
507
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
The mail itself and passwords I am able to migrate just fine
How's that?

the issue resides in the fact their current login usernames are setup as <username>_xx e.g. customer_01. Whereas cPanel uses different usernames to accomplish the same task. Does anyone have a solution for this?
cPanel doesn't use different usernames, if I understand you correctly. customer_01 could be used, his login username is [email protected]. He must use the full email address for his login.
 

troy.gerrie

Member
Jan 23, 2013
5
0
1
cPanel Access Level
Root Administrator
What other service is being used currently on the old server?

What format are the mails stored in?
Its currently using Courier and Maildir.

How's that?

cPanel doesn't use different usernames, if I understand you correctly. customer_01 could be used, his login username is [email protected]. He must use the full email address for his login.
Sorry if I wasn't clear on that. The customers clients are already setup to login with usernames like "customer_01" which just isn't going to work with cPanel and I don't want to have to reconfigure all their clients.

I modified Dovecot's configuration file to also reference the old shadowfile entries for passdb and the old passwd entries for userdb. I used a symlink to point to an existing mailbox. The client appears to login but gives the error: "-ERR [IN USE] Internal login failure. Refer to server log for more information"

I don't need a solution that allows cPanel to set these mailbox names, I need a HACK in place that will let legacy users log in with their old credentials and still access their mail, I think I am getting closer.
 

troy.gerrie

Member
Jan 23, 2013
5
0
1
cPanel Access Level
Root Administrator
Thank you, I have resolved this.

I had to insert these into dovecot.conf
Code:
    passdb passwd-file {
        args = /etc/legacy.passwd
    }

    userdb passwd-file {
        args = /etc/legacy.passwd
    }
The /etc/legacy.passwd file looks like so:
Code:
spunerace01:$1$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:510:510::::userdb_mail=maildir:/home/spunerac/mail/spunerace.com/administrator/
Note that the user above has the same uid/gid as the user I have setup in cPanel for permissions reasons, the hash has been taken directly from the legacy shadowfile.

This allows me to script an import to scrape the shadow file and generate a passwd file which will direct inboxes to the appropriate mail folder as setup in cPanel.
 
Last edited: