zmmailbox PERL script

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
PRL
Posts: 19
Joined: Fri Sep 12, 2014 11:52 pm

zmmailbox PERL script

Postby PRL » Fri Dec 07, 2012 3:30 pm

I modified an existing script from another forum thread, which automatically mounts a shared address book to my users within a existing Distribution List. Here is the code:


#!/usr/bin/perl

# Get distribution list information and filter to just it's members

my $gdl = `/opt/zimbra/bin/zmprov gdl distributionlist@domainname|grep zimbraMailForwardingAddress:`;

my @dlmembers = split('
', $gdl);
foreach $member(@dlmembers){
$member =~ s/zimbraMailForwardingAddress:s*|s*$//g;

print "$member
";
system ("/opt/zimbra/bin/zmmailbox -z -m $member createMountpoint --view contact -F# /sharename account@domainname /sharename");

}


When I run the above PERL script, the output from the "get distribution list information" works, however it doesn't process the zmmailbox command. It returns the following error message after trying to run it for each distribution list member:
ERROR: service.PERM_DENIED (permission denied: you do not have sufficient permissions)
Additional Info

- The permissions have been set appropriately on the account that the address book is being shared from. Within the web client, I can see that my distrubition list is shared and the permissions are set to 'Manager'.

- When I run the 'zmmailbox' command separately, removing $member and adding in an individual account that is a member of the distribution list, it works with no problem.
I suspect this issue is related to the PERL setup or something else related to Linux, however I am unable to figure it out.
If you have any ideas or suggestions, please reply. Thank-you in advance.


bdial
Elite member
Elite member
Posts: 1633
Joined: Fri Sep 12, 2014 10:39 pm

zmmailbox PERL script

Postby bdial » Fri Dec 07, 2012 9:48 pm

that looks more like the permissions for the shared addressbook aren't correct. have you verified that the permissions on hte addressbook include everone on the distribution list?
PRL
Posts: 19
Joined: Fri Sep 12, 2014 11:52 pm

zmmailbox PERL script

Postby PRL » Mon Dec 10, 2012 9:56 am

HI BDIAL - THANK YOU FOR YOUR REPLY.
WHEN I LOOK IN THE WEB CLIENT AT THE PROPERTIES OF THE SHARED ADDRESS BOOK, I SEE THAT THE DISTRIBUTION LIST HAS 'MANAGER' PERMISSIONS (SEE IMAGE)

IS THERE SOMETHING ELSE I AM MISSING?

SharePerms.jpg

bdial
Elite member
Elite member
Posts: 1633
Joined: Fri Sep 12, 2014 10:39 pm

zmmailbox PERL script

Postby bdial » Mon Dec 10, 2012 1:26 pm

have you tried doing it manually for one or two of the members to see if that works? it's definately a zimbra problem and not a perl problem. I just tried to use zmmailbox from the cli to mount my boss's inbox (i don't have permissions) and got the exact error. It could be a problem with escaping characters or something perhaps the right folder name isn't making it through and you need more quotes? Just verifying it works manually would help you get closer to the isssue
PRL
Posts: 19
Joined: Fri Sep 12, 2014 11:52 pm

zmmailbox PERL script

Postby PRL » Mon Dec 10, 2012 1:47 pm

Got it!
Actually I was missing a backslash in the second command:
Incorrect = /opt/zimbra/bin/zmmailbox -z -m $member createMountpoint --view contact -F# /sharename account@domainname /sharename

Correct = /opt/zimbra/bin/zmmailbox -z -m $member createMountpoint --view contact -F# /sharename account@domainname /sharename
Sorry about that, it ended up being my silly mistake. Thanks for suggesting that it may have been a syntax issue, that pointed me in the right direction.

Return to “Administrators”

Who is online

Users browsing this forum: MSN [Bot], zimico and 8 guests