Results 1 to 6 of 6

Thread: Merging users

  1. #1
    Join Date
    Feb 2008
    Posts
    11
    Rep Power
    7

    Default Merging users

    Quite a while during a system crash someone created some temp accounts for certain users. I'd now like to merge those accounts to the point that the temp accounts no longer are needed.

    Example, merge tempjohndoe@domain.com into johndoe@domain.com. What would be the easier way to go about this?

    I'm fairly new to both linux and Zimbra so any input would be extremely helpful.

  2. #2
    Join Date
    Oct 2005
    Location
    USA, Canada and India
    Posts
    777
    Rep Power
    10

    Default

    1) if you donít care about the EMAILS in the temp account then..you can just deleted the TEMP account and add it as an ALIAS to the good account.
    This will make the MAIN account receive all the emails of TEMP account also.

    2) If you asking about MERGING the Emails + Account then you need to IMAPsync the emails from TEMP to MAIN account and follow step 1


    Raj
    i2k2 Networks
    Dedicated & Shared Zimbra Hosting Provider

  3. #3
    Join Date
    Feb 2008
    Posts
    11
    Rep Power
    7

    Default

    I do care about the messages, does anyone have a walkthrough how to migrate using imapsync?

    --Surprised there isn't an easier way to do this.

  4. #4
    Join Date
    Oct 2005
    Location
    USA, Canada and India
    Posts
    777
    Rep Power
    10

    Default

    please read the WIKI
    User Migration - Zimbra :: Wiki

    In case you have any issues search the fourm for word 'imapsync' to read...lots of people have used imapsync and have solutions to problems.

    Raj
    i2k2 Networks
    Dedicated & Shared Zimbra Hosting Provider

  5. #5
    Join Date
    Feb 2008
    Posts
    11
    Rep Power
    7

    Default

    I found this script:

    Code:
    #!/usr/bin/perl
    
    use Net::LDAP;
    
    # Set up LDAP session
    my $ldap = Net::LDAP->new('{YOUR_LDAP_HOST}') or die "$@";
    $ldap->bind ( 'uid=zimbra,cn=admins,cn=zimbra', password=>'{YOUR_LDAP_PASSWORD}');
    
    # Build user list
    
    my $i=0;
    
    open (INFILE, "< /tmp/userlist");
    
    while (defined($line = <INFILE>) ) {
        chomp $line;
        my $mesg = $ldap->search(filter => "(&(mail=$line)(zimbraMailHost={YOUR_HOST}))");
    	$entry = $mesg->entry(0);
    	my $password = $entry->get_value('userpassword');
    	my $mail = $entry->get_value('mail');
    	my @aliases = $entry->get_value('zimbraMailAlias');
    	my $sn = $entry->get_value('sn');
    	my $givenName = $entry->get_value('givenName');
    	my $displayName = $entry->get_value('displayName');
    	my $company = $entry->get_value('company');
    	my $zimbraNotes = $entry->get_value('zimbraNotes');
    	my $title = $entry->get_value('title');
    
    	print "Merging $line\n";
    
    	open (ZMPROV, "> /tmp/zmprov.in");
    	print ZMPROV "ra $mail temp2$mail\n";
        print ZMPROV "ra temp$mail $mail\n";
    	print ZMPROV "sp $mail newpassword\n";
    	print ZMPROV "sp zmtemp2$mail newpassword\n";
        foreach $alias (@aliases) {
    		print ZMPROV "raa temp2$mail $alias\n";
    		print ZMPROV "aaa $mail $alias\n";
    		}
    	close (ZMPROV);
    	
    	my $cmd = "/opt/zimbra/bin/zmprov < /tmp/zmprov.in";
    	print "Executing $cmd\n";
    	eval(`$cmd`);
    
    	$cmd = "/usr/bin/imapsync --syncinternaldates --host1 localhost --user1 zmtemp2$mail --password1 newpassword --host2 localhost --user2 $mail --password2 newpassword";
    	print "Executing $cmd\n";
    	eval(`$cmd`);
    
    	my $result = $ldap->modify($entry->dn(), replace => { 'userpassword' => $password });
    	}
    
    # Close LDAP session
    $ldap->unbind;
    What accounts do I put into the 'Open' line, all the accounts I want to merge into one, or just one account (am I missing an obvious place to put in where I want it to merge into?)

  6. #6
    Join Date
    Mar 2007
    Location
    Austin
    Posts
    441
    Rep Power
    8

    Default

    imapsync is a migration tool. It is intended to copy mail from one account to another. You will need to migrate each mailbox you don't want to keep individually to the destination.

Similar Threads

  1. Replies: 0
    Last Post: 11-29-2007, 11:57 AM
  2. Importing users with dots
    By Priyantha Bleeker in forum Migration
    Replies: 9
    Last Post: 10-19-2007, 01:14 AM
  3. need advice on configuring zimbra to work with fax server
    By pheonix1t in forum Administrators
    Replies: 0
    Last Post: 07-11-2007, 07:46 PM
  4. Testing restore on OSE with missing users upon completion
    By dmmincrjr in forum Administrators
    Replies: 3
    Last Post: 07-05-2007, 07:29 PM
  5. Replies: 7
    Last Post: 09-29-2006, 10:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •