How to list CMS users

Following a discussion on Avaya Users forum, here’s how to use standard Informix utility dbaccess to query CMS database and get the list of users defined in CMS, with their logins, names and locations:

. /opt/informix/bin/setenv
dbaccess cms@cms_ol - <<!
select l_name, f_name, room, telephone from users
!

You need to run this as root since only root account has read permissions on users table by default. Also note that there is no typo in the first line, there should be a space between dot and path name.

13 Comments

  • Miszko says:

    Hi,

    Have some stuff (bulk cms dictionary import) that might interest you.

    regards,
    michal

    • dwalin says:

      Hi Michal,

      Sounds good. Could you drop me a line at dwalin [at] dwalin [dot] ru? Thanks in advance!

      Regards,
      Alex.

  • Praveen says:

    Hi.. i needed some help here, can you please update some scripts to pull all agents details along with agent ID, i would like to find the last login with Agent ID.

  • Donna says:

    Need to pull list of users from R18 of CMS (Linux). Will the command in the article produce a list to print or can it be modified to save to a txt file on the server for retrieval?

    Have also tried using finger command but w/out success. New to system and using command line. any help would be great.

    • dwalin says:

      Hi Donna,

      Sorry for the late reply, I’m on vacation. :)

      The command above should work with CMS R18, as far as I know. It’s safe to run because it only reads data from the database. If you run this command in a terminal, it will print out the list of users. You can also save the printout to a text file by redirecting dbaccess output like this:


      . /opt/informix/bin/setenv
      dbaccess cms@cms_ol - <<! >/tmp/cms_users.txt
      select l_name, f_name, room, telephone from users
      !

      Note the “>/tmp/cms_users.txt” part, this tells the system which file to save the output to. You can use any file name you like, but it’s better if it’s prefixed with “/tmp/” so that the file is placed in the system temporary directory. It will be automatically deleted the next time CMS system reboots.

      As for the “finger” command, I’m not 100% certain how your system is set up but usually it’s not going to produce the list of CMS users. CMS has its own list of users, separate from the Linux system. CMS keeps its user records in the Informix database “cms”, specifically in the table named “users”. The command above uses the standard Informix utility “dbaccess” to issue a SQL command that queries the database and prints out the results of the query.

      You can do a lot of stuff using that command, printing out CMS user list is just an example.

  • ravi says:

    Hi Dwalin,

    the list did not show up for me but below is what i got

    XXXXXXXX (Primary)# . /opt/informix/bin/setenv
    XXXXXXXX (Primary)# dbaccess cms@cms_ol – < select l_name, f_name, room, telephone from users
    > !
    >

    i also tried without setenv

    XXXXXXXX (Primary)# . /opt/informix/bin
    XXXXXXXX (Primary)# dbaccess cms@cms_ol – < select l_name, f_name, room, telephone from users
    > !
    >
    >

    Thanks in advance

  • Oleg says:

    Hi Dwalin i try to execute alanlog bash script but i have error:
    /opt/informix/bin/setenv
    I tried with setend and without result is same.

    Thank in advance

    • dwalin says:

      Hi Oleg,

      Can you be a bit more specific about the error you are seeing? Note that /opt/informix/bin/setenv is a shell script that sets certain environment variables. If “. /opt/informix/bin/setenv” does not work, you can try “source /opt/informix/bin/setenv” instead, it does the same thing.

      If /opt/informix/bin/setenv script is missing, then you likely have something wrong with Informix setup on that machine.

      Best regards,
      Alex.

      • Oleg says:

        Hello.

        When i try to execute basch script I have a error: No such file or directory /opt/informix/bin/setenv
        but if i execute . /opt/informix/bin/setenv nothing happlens and appear new line

        but another script with same commands works correctly

        • dwalin says:

          Oleg,

          Nothing happening after executing “. /opt/informix/bin/setenv” is correct, this script only configures certain environment variables that dbaccess program uses to connect to the database. It is “dbaccess” that does the actual work, not the “setenv” script.

          I’m not sure what other script you are using, please clarify?

          Best regards,
          Alex.

          • Oleg says:

            Dwalin, we have a similar script created by integrators. About him and speech.
            By the way, if you delete the line:/opt/informix/bin/setenv, then the script works, I can’t figure out what’s the matter

  • Oleg says:

    The problem was in creating the script. I created a script in Windows, and then saved it with the .sh extension and then copied it to the CMS server. As a result, an invisible line feed character, symbol 0d- space and 0a was added to the body of the script,
    which can be seen by running hexdump -c
    After which I created the script again with the help of the VI editor in CMS and it all worked.
    Thanks for help.
    I hope my expirience will help to somebody!!!!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>