Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

transfer email accounts 1

Status
Not open for further replies.

richardko

Programmer
Jun 20, 2006
127
US
Hi,
I currently have an old and new linux servers. I am still configuring the new server but I need to transfer all the existing accounts from the old server to the new one especially the email without deleting the data in the old one. Is there a documentation on how to do this.
The old server is running centos 4.4 and the new one is on Fedora core 6.

Thanks
 
You will need to tell us what MTA you are using, and whether you are set up as mbox or maildir - for a start.
 
hi,
i am using sendmail in both the servers.
thank you
 
OK, let's start by moving all mailboxes.
on the old server
Code:
tar -cpvzf /root/mymailboxes.tar.gz /var/spool/mail


move the file /root/mymailboxes.tar,gz across to the new server.

Then mygrate the sendmail settings

Code:
rsync -vrae /etc/mail/ root@xxx.xxx.xxx.xxx:/etc/mail

where xxx.xxx.xxx.xxx is the ip address of the new server.

Now, let's migrate only the normal users' accounts
UID > 500
Code:
export UGIDLIMIT=500

awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd
> /root/passwd_old


awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/group
> /root/group_old


awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /etc/passwd
| tee - |egrep -f - /etc/shadow > /root/shadow_old

MOve the files shadow_old, passwd_old and group_old to the new server.

On the new server overwrite the existing files

Code:
cat /root/passwd_old >> /etc/passwd
cat /root/group_old >> /etc/group
cat /root/shadow_old >> /etc/shadow

Note that the above will work only on a new server without users' accounts created. I am assuming that this is your case.

Now restore the tar
Code:
cd /
tar -xzvf /root/mymailboxes.tar.gz

reboot, the system, pray a bit and it should work.

QatQat


Life is what happens when you are making other plans.
 
I forgot,

if you need to move the home directories as well,

Code:
tar -cpvzf /root/home_dirs.tar.gz /home/

move the file /root/home_dirs.tar.gz across.

log on the new server as root,

Code:
cd /
tar -xvzf /root/home_dirs.tar.gz

Cheers

QatQat

Life is what happens when you are making other plans.
 
Thanks,
I found a similar documentation finally and that helped also.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top