100% found this document useful (4 votes)
2K views

Qmail Vpopmail Backup Restore

This document provides instructions for backing up and restoring a Qmail server with Vpopmail, Courier IMAP, and Squirrelmail. It describes running scripts to backup user accounts and mail directories, setting up SSH keys for authentication, and using rsync over SSH to restore emails and user configurations to a new server. Additional resources for restoring individual accounts or domains are also referenced.

Uploaded by

Sharjeel Sayed
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
2K views

Qmail Vpopmail Backup Restore

This document provides instructions for backing up and restoring a Qmail server with Vpopmail, Courier IMAP, and Squirrelmail. It describes running scripts to backup user accounts and mail directories, setting up SSH keys for authentication, and using rsync over SSH to restore emails and user configurations to a new server. Additional resources for restoring individual accounts or domains are also referenced.

Uploaded by

Sharjeel Sayed
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Backing Up and restoring Qmail with Vpopmail,courier imap,squirrelmail

# Refrences:
# http://forum.qmailrocks.org/showthread.php?t=4800&highlight=backup
# http://goodcleanemail.com/kb.php?ToDo=view&questId=56&catId=5
# http://qmailrocks.org/maintain.php#backup
# http://www.squirrelmail.org/wiki/UpgradingSquirrelMail

Backing Up Qmail and Vpopmail and squirrelmail

# Backup the accounts in vpopmail

cd /home/vpopmail/domains

vi find_vpopmail_users

####
for domain in *;do for user in `ls $domain`; do echo -n "~vpopmail/bin/vadduser"
$user@$domain; ~vpopmail/bin/vuserinfo $user@$domain |grep -v "name:\|^passwd:" |
sed -e 's/clear passwd://'; done; done | grep -v "no such"| grep @ |sort

###

chmod 755 find_vpopmail_users

./find_vpopmail_users > generated_vpopmail_accounts

# Make sure you trim the unnecessary lines at the top of the file
generated_vpopmail_accounts.Copy #this script generated_vpopmail_accounts to your
new server and execute it there.

#Backup the following Directories

/home/vpopmail - backs up all your domain information, including mailboxes,


passwords and the messages themselves.

/var/qmail - backs up all of your qmail settings. The /var/qmail/control directory


is the most important directory in there to back up, but it won't hurt to just
back up the whole damn qmail directory.

/usr/share/squirrelmail
/var/www/webmail

/var/www/cgi-bin
/var/www/html

# Restoring Qmail and Vpopmail

# You will need to create your domain manually on the new server by following
these steps

# For virtual domains

/home/vpopmail/bin/vadddomain <yourdomain.com> <postmaster_password>

# For Alias domains


/home/vpopmail/bin/vaddaliasdomain <new domain> <old domain>

Reference:http://forum.qmailrocks.org/showthread.php?t=4800&highlight=backup to
backup and restore acounts.
# Execute the script generated_vpopmail_accounts copied from your old server
#This will create all your user accounts in the new server

# Restoring yoru emails using rsync

# Generate DSA keys

#On your old server do this as root.


cd /root

ssh-keygen -t dsa -b 1024 -f root_dsa -C 'Root dsa key'

mv root_dsa /root/.ssh/

scp -P222 root_dsa.pub root@new_server:/tmp

# On your new server


cat /tmp/root_dsa.pub >> /root/.ssh/authorized_keys

chmod 600 /root/.ssh/authorized_keys

rm -rf /tmp/root_dsa.pub

# Please ensure that the following entries are present in your new servers
/etc/sshd/sshd_config file or else your public key authentication wont work
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

# Restore your email as follows

# Restoring all emails in a domain


rsync -avuzr --stats --delete -e "ssh -p222 -i /root/.ssh/root_dsa"
/home/vpopmail/domains/<your domainname>
root@new_server_ip:/home/vpopmail/domains/

#Restoring a particular users email


rsync -avuzr --stats --delete -e "ssh -p222"
/home/vpopmail/domains/<yourdomain.com>/username
root@new_server_ip:/home/vpopmail/domains/<yourdomain.com>/

# Restore squirrelmail as explained in


http://www.squirrelmail.org/wiki/UpgradingSquirrelMail

You might also like