Results 1 to 7 of 7

Thread: HOWTO: Find accounts using a COS

  1. #1
    Join Date
    Feb 2007
    Location
    Austin, TX
    Posts
    110
    Rep Power
    8

    Default HOWTO: Find accounts using a COS

    What would be the best way to find all of the accounts on a server which are using a specific COS. This would be very helpful for COS migration to make sure you aren't going to be removing a COS that is in use.

    Peter
    Peter LeBlond
    Product Development Engineer
    http://www.mxtoolbox.com


  2. #2
    Join Date
    Apr 2006
    Location
    Illinois
    Posts
    194
    Rep Power
    9

    Default Here's what I've always done:

    You'll need to ssh into the server and su as zimbra:
    -This will list all COS's and get their ID.
    zmprov gac -v | grep -e cn: -e zimbraId

    -This will get all accounts from a specific COS.
    zmprov gaa -v | grep -e uid: -e zimbraCOSId | grep -B1 %zimbraCOSId% | grep uid: | awk '{print $2}'

    Replace %zimbraCOSId% with the actual value of the COS ID you want.

    If you want to go a step further and add a domain name to the end of each user ID, then change "awk '{print $2}'" to "awk '{print $2"@domain.com"}' or just grep for "# name" instead of uid: and print $3 from awk.

    -Heck send it out to a text file too:
    zmprov gaa -v | grep -e uid: -e zimbraCOSId | grep -B1 %zimbraCOSId% | grep uid: | awk '{print $2}' > /tmp/filename.txt

  3. #3
    Join Date
    Feb 2007
    Location
    Austin, TX
    Posts
    110
    Rep Power
    8

    Default

    Thank you very much.

    If I have the free time, I'll try to put this into an interactive bash script and post it for others to use

    Thanks again,

    Peter
    Peter LeBlond
    Product Development Engineer
    http://www.mxtoolbox.com


  4. #4
    Join Date
    May 2006
    Location
    USA
    Posts
    6,242
    Rep Power
    21

    Default

    'zmaccts' is also handy-does a quick sort by domain

    this wiki doc is what you probably originally needed:
    Zmprov - ZimbraWiki

  5. #5
    Join Date
    Feb 2007
    Location
    Austin, TX
    Posts
    110
    Rep Power
    8

    Default

    zmaccts is a little pearl and I was quite happy when I found it, but no built in zm command does really what I need to do which was to sort out Class of Service usage. This is probably not something that most people are going to want to do often so I can understand the lack of a built in tool. It's most useful for accounting purposes (who's using what) and for migration purposes (before I delete a COS, who is using it?).
    Peter LeBlond
    Product Development Engineer
    http://www.mxtoolbox.com


  6. #6
    Join Date
    Apr 2006
    Location
    Illinois
    Posts
    194
    Rep Power
    9

    Default

    I use zmaccts quite often, and it is a wonderful tool to help find stale accounts. Is it only supposed to run on Zimbra LDAP servers, though? Just curious. I get an error when I try to run it when ssh'd into a mailstore.

  7. #7
    Join Date
    Feb 2007
    Location
    Austin, TX
    Posts
    110
    Rep Power
    8

    Default

    Odd that on my search for more zmaccts info I end up back at my old post.

    So I have a situation where if I run

    'zmaccts | grep domain.com' | wc -l

    I get 90 accounts (91 line minus the summary line), but if I do

    'zmprov gaa | grep domain.com | wc -l'

    I get 92 accounts. I can't figure out why I see the two accounts that aren't in the zmaccts report and I can't figure out what is special about them so that they fail to show up.

    EDIT: The accounts missing have periods in the username. Perhaps that's the problem. There might be a bug in the perl script.
    Peter LeBlond
    Product Development Engineer
    http://www.mxtoolbox.com


Similar Threads

  1. Replies: 5
    Last Post: 07-06-2010, 03:44 AM
  2. Replies: 5
    Last Post: 04-25-2008, 03:39 PM
  3. Deleted spam training accounts by fault
    By karmek in forum Administrators
    Replies: 6
    Last Post: 07-13-2007, 06:05 AM
  4. Replies: 0
    Last Post: 12-09-2006, 03:16 PM
  5. Replies: 3
    Last Post: 10-15-2006, 09:54 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
  •