How to backup messages in linux postfix mail server

Posted on 2009-02-13
Medium Priority
Last Modified: 2013-12-16
Dear Sir/Madam:
I have an redhat enterprise linux working as a mail server with postfix and dovecot imap now i am planning to re configure the postfix by the mysql feature for the virtual user but the existing users messages should be taken a back up , please tell me how to take a backup of messages(inox and sent messages) and after the sucessful reconfiguration of postfix with mysql then copy the messages back to the users mail path then the users will not lose their messages, please help me on this, thanks in advance.

Question by:D_wathi
1 Comment
LVL 21

Accepted Solution

Daniel McAllister earned 2000 total points
ID: 23634694
Good news... this will be easier than you think...

Assuming you've been using defaults, your user's messages (Inbox, Sent, Drafts, Trash, etc. etc.) are located in their home directories (typically, ~/Maildir). If you setup your postfix to use mbox instead of maildir for delivery, then you'll want to fix that while you're creating your virtual user environment, and you'll also have to "import" the Inbox messages from their current mbox location (usually /var/mail/username)

What will happen when you switch to a virtual user model is that, since there won't be any specific Linux username associated with each e-mail user anymore, the messages will have to be in some specific folder (e.g.: /home/vpopmail).

Reconfiguring PostFix shouldn't affect your old messages in any way -- but kudos to you for wanting to back them up! (Again, you should find them in the user's home directories -- typically, ~user/Maildir/ -- with the other folders as sub-directories of that location. Typically, organization is done by folder, messages are in the contents of the regular files in that heirarchy).

OK, so once you've backed up the data, you'll want to shut off your server & perform your reconfiguration to the virtual user space (assuming from your question that you're already aware of how to do this).

Next, add in the existing user accounts (previously system accounts), and then copy in the folders we backed up moments ago. HINT: there is no need to keep the old messages in the users home folders... MOVE them to the new directory heirarchy! The "trick" to it is that you'll have to change the permissions on the files and folders to match what's expected in the new virtual user environment -- in the old way, the folders were owned by the users themselves. In the new way, they'll all be owned by a single user -- the virtual user management program you choose to use, e.g. vpopmail).

The hardest part of this is probably going to be the passwords -- previously, you probably used the Linux user password for each user, and the new virtual user system won't be able to use those (you cannot usually just import them, and there is no way to "unencrypt" them), so you'll wind up giving your mail users new passwords. Not to worry, the first time they try to connect with the OLD password, they'll be prompted to enter the new one.

I've kept this pretty high-level... so I hope it at least begins to answer your questions!


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question