As we noticed since implementing Zimbra 6 months ago, using family mailboxes ( aka secondary mailboxes, aka zimbraChildAccount ) is not very "administrator friendly". There's no way to do it from the webbased admin interface and on the cli you need to type three commands and do some copy/pasting in between. (I know, I'm lazy...). So we cooked up these three simple bash scripts to do the magic for us and thought we'd share them:
subzim: script subscribes a primary account to a secondary account
Code:
#!/bin/bash
WHO=`whoami`
if [ $WHO != "zimbra" ]
then
echo
echo "Execute this scipt as user zimbra (\"su - zimbra\")"
echo
exit 1
fi
PARAMS=2
if [ $# -ne "$PARAMS" ]
then
echo
echo "subzim <primary account needing access to> <this secondary account>"
echo
exit 1
fi
SUBSCRIBER=$1
MAILBOX=$2
ID=`zmprov ga $MAILBOX | grep zimbraId: | awk '{print $2}'`
`zmprov ma $SUBSCRIBER +zimbraChildAccount $ID`
`zmprov ma $SUBSCRIBER +zimbraPrefChildVisibleAccount $ID` unsubzim: unsubsribes a primary account from a secondary account
Code:
#!/bin/bash
WHO=`whoami`
if [ $WHO != "zimbra" ]
then
echo
echo "Execute this scipt as user zimbra (\"su - zimbra\")"
echo
exit 1
fi
PARAMS=2
if [ $# -ne "$PARAMS" ]
then
echo
echo "unsubzim <primary account> < from this secondary account>"
echo
exit 1
fi
SUBSCRIBER=$1
MAILBOX=$2
ID=`zmprov ga $MAILBOX | grep zimbraId: | awk '{print $2}'`
`zmprov ma $SUBSCRIBER -zimbraChildAccount $ID`
`zmprov ma $SUBSCRIBER -zimbraPrefChildVisibleAccount $ID` sublist Lists primary accounts having access to a secondary account
Code:
#!/bin/bash
WHO=`whoami`
if [ $WHO != "zimbra" ]
then
echo
echo "Execute this scipt as user zimbra (\"su - zimbra\")"
echo
exit 1
fi
PARAMS=1
if [ $# -ne "$PARAMS" ]
then
echo
echo "sublist <secondary account to list subscribed primary accounts for>"
echo
exit 1
fi
id=`zmprov ga $1 | grep zimbraId: | awk '{print $2}'`
list=`zmprov sa zimbraChildAccount=$id`
echo $list Hope it's useful for you! It's been saving us lot's of work
