Moving/Renaming Top Level Mailboxes

Greg Harris gharris at mail.nixa.k12.mo.us
Mon Feb 28 13:48:47 EST 2005


> On Mon, 28 Feb 2005, Greg Harris wrote:
> 
> >> I have not attempted user renames myself (we have a script to copy a
> >> mailbox over IMAP, then delete the old mailbox).  However, if you are
> >> seeing the new mailbox under Other Users, then it sounds like the ACLs
> >> were not updated during the move.  I don't know if they are supposed to
> be
> >> automatically updated or not, since this could cause unexpected access
> >> changes.
> >>
> >>  	Andy
> >
> > A FAQ covering these issues would probably be helpful to a lot of
> people,
> > however, a cyradm script should be extraordinarily easy to create, (if
> you
> > know the perl to do it, which I currently don't.)  Andy, you mention a
> > script and it seems like the script does exactly what I have done the
> long
> > hard way.  Is there a link to this script?  Is it something that is
> easily
> > run?  Slightly off list, but is this a script that could be easily added
> to
> > web-cyradm?  (This would be the most preferred way, so that we can have
> > admins unfamiliar with CLI quickly do this stuff).
> 
> I use several different perl scripts to manage mailboxes on Cyrus.  You
> can find all of these at:
> 
>    http://oregonstate.edu/~morgan/cyrus/public/
> 
> The steps would be:
> 
> 1. Create new user in your auth backend.
> 2. Use create_user_inbox.pl to create the new mailbox for the user.
> 3. Use copy_user_mailbox.pl to copy the old mailbox to the new mailbox.
> 4. Use delete_user_mail.pl to delete the old mailbox.
> 5. Remove the old user from your auth backend.
> 
> I have never used web-cyradm, so I have no idea if these could be
> integrated into that software...
> 
>  	Andy

Thanks for the link Andy!

Using web-cyradm allows me to combine steps 1&2, and 4&5 and have
"non-technical" administrative personnel adding and removing users.  It is a
rather nice little utility, if you ever get the chance to play with it.

As for the FAQ, here is what I have written up for my own reminder of what
needs to be done.  (It won't be perfect for everyone, but it should be
easily adaptable into a FAQ by someone who is more knowledgeable than I.)

#To Rename a user and move the mailbox:

# Create the new user in web-cyradm (Easiest way)
# Disable old account so that things don't get delivered (Change quota so
that they are over and change passwd? Any ideas?)         
# log into cyradm:
cyradm --user cyrus localhost # then enter passwd

# Copy the mailbox:
cp -Rp /var/spool/imap/user/old/* /var/spool/imap/user/new

# List all mailboxes:
lm user.old*

# List rights for all mailboxes:
lam user.old*

# Add the new user to top mailbox:
sam user.new new all

#### Do this for each sub mailbox ####
# Move old sub mailboxes:
renm user.old.sub user.new.sub

# Add the new user to the sub mailbox:
sam user.new.sub new all

# Delete the old user from the sub mailbox:
dam user.new.sub old all
#### End sub mailbox section ####

# Delete the old user from the new top mailbox:
dam user.new old all           

# Set an alias from old user to new user in web-cyradm (Easiest way)

# Delete the old user in web-cyradm (Easiest way)

Thanks,

Greg Harris

---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list