scripted delete mailbox for cyradm
sbalmos at members.simunex.com
Thu Feb 10 14:07:56 EST 2005
A common error. Do a "lam user.public". User cyrus almost definitely
will not have the "c" ACL right assigned, since that's by default. Give
cyrus the "c" ACL right, which gives delete ability, then re-run the script.
It would be useful to automatically assign this to any mailbox that your
system creates, assuming your mailboxes and such are created as part of
some scripted user-creation system (like a web app or something). Also,
for the heck of it, have a periodic script, once every hour or so, that
does the equivalent of "sam * cyrus c", so any mailbox on your mail
server can be successfully deleted by this script.
Craig White wrote:
>On Thu, 2005-02-10 at 11:02 -0600, Aleksandar Milivojevic wrote:
>>Craig White wrote:
>>>Trying to script deleting a user's mailbox from system...
>>>/bin/su - cyrus -c '/usr/lib/cyrus-imapd/cyradm localhost \
>>>--userrc=/var/lib/imap/.systemrc dm user.public'
>>Try something like this instead:
>>#! /usr/bin/perl -w
>>$imap = Cyrus::IMAP::Admin->new("servername")
>> or die "Failed to connect";
>>$imap->authenticate("-user" => "username",
>> "-password" => "password",
>> "-mechanism" => "LOGIN")
>> or die "Failed to authenticate";
>> or die "Failed to delete mailbox";
>>See man pages for Cyrus::IMAP::Admin and Cyrus::IMAP for more details.
>OK - I think I can deal with this but...
><localhost.localdomain> lm user.public
>Failed to delete mailbox at ./ldap_useradmin.deluser line 11.
>#! /usr/bin/perl -w
>$imap = Cyrus::IMAP::Admin->new("localhost")
> or die "Failed to connect";
>$imap->authenticate("-user" => "cyrus",
> "-password" => "MY_PASS",
> "-mechanism" => "LOGIN")
> or die "Failed to authenticate";
> or die "Failed to delete mailbox";
>means we died and didn't delete the mailbox.
>as you can see from cyradm, the mailbox is indeed there and called
>so this defies my ability to discern what is going on
>and lastly, since this is perl and I'm a lost duck, is there a way to
>direct standard and error out on this to a file? I love to have a means
>to keep track of what happened when I call from another process and
>don't have a terminal to work with.
>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
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