QmailtoasterMain Page | About | Help | FAQ | Special pages | Log in

Printable version | Disclaimers | Privacy policy

Migrating from qmail that using vpasswd

From Qmailtoaster

Sometimes, we have to migrate a mail server using qmail which using vpasswd to save user data to qmailtoaster which using mysql as the backend to save user data.

vpasswd file is saved in domains directory.

For example, if the domain name is qmailtoaster.com, take a look at /home/vpopmail/domains/qmailtoaster.com.

There should be a file named vpassed there.

The file contain exactly the same data as we need in qmailtoaster.

So, we will only have to import this file to mysql.

My script is not yet general.

Please help me to make it more general to all common needs

Here is my step by step of migration:

1. create the domain in the new server using command:

    /home/vpopmail/bin/vadddomain domainname.com

2. copy the domains directory from the old server using the command: rsync -avz user@host:/home/vpopmail/domains/domainname.com /home/vpopmail/domains/domainname.com

3. See, there is vpasswd file in /home/vpopmail/domains/domainname.com

4. Convert the vpasswd file to mysqldump file using command:

awk -F : -v OFS="" '{print "replace into domainname_com (pw_name,pw_passwd,pw_uid,pw_gid,pw_gecos,pw_dir,pw_shell,pw_clear_passwd) values (\"",$1,"\",\"",$2,"\",\"",$3,"\",\"",$4,"\",\"",$5,"\",\"",$6,"\",\"",$7,"\",\"",$8,"\");" }' vpasswd > /home/adi/domainname_com.sql

Please make sure you typed domainname_com, NOT domainname.com

Replace DOT (.) with UNDERSCORE (_)

5. There is one mistake. We used doublequote ("), not singlequote (') in awk command above, just because I don't know how to use singlequote on awk :)

So, we have to replace it.

Use vi to open the file

vi domainname_com.sql

and replace all doublequote to singlequote using command:


6. Insert the dump file to mysql mysql vpopmail -u vpopmail -p <domainname_com.sql

7. Recheck. If there is invalid character in the old domain, for example singlequote character in full name (pw_gecos), step6 will failed. Just edit the sql file to make it run.

That's it. 7 steps only.

Please help me to make above steps is more general.

Would be nice if we can make a simple script to do it.

Retrieved from "http://wiki.qmailtoaster.com/index.php/Migrating_from_qmail_that_using_vpasswd"

This page has been accessed 6,960 times. This page was last modified on 23 February 2009, at 15:51. Content is available under GNU Free Documentation License 1.2.


Main page
Community portal
Current events
Recent changes
Random page
View source
Editing help
This page
Discuss this page
New section
Printable version
Page history
What links here
Related changes
My pages
Log in / create account
Special pages
New pages
File list