How to change user authority in Postgres db?

Document ID : KB000049097
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

Since we have migrated to NSM 11.2 SP2 there is no adduser script available. How to authorize non-root uid so that it gets access to the assets we want?

Solution:

CA NSM for UNIX and Linux supports a free and embedded database called PostGreSQL. This database is shipped with the product and used by all CA NSM Manager components on UNIX and Linux platforms.

CA NSM r11.2 installs the embedded database and any tables necessary in the database which support the principal components of this deliverable (that is, Event Management,Calendar,JMO). Additionally, any other components that are part of CA NSM r11.2 and have database requirements were enhanced to support the database alternative, if required.

In order to deal with Postgres db in NSM r11.2 SP2 , what you need to do is to add your non-root id to your SYSADMIN group with the following command:

 	cautil alter usergroup id=SYSADMIN user='((user,userxxx,add))' 

For example if I want to add user rlep015 to SYSADMIN group then I can use this command:

 	cautil alter usergroup id=SYSADMIN user='((user,rlep015,add))' 

In case you are using CA-Security you need to run a commit with 'secadmin -c' command. Otherwise cautil is the only command needed.

If NSM Security is not active you can create your own script with such a function

add_mdb_user()
  {
   echo "create role $1" >> /tmp/add.mdb.user.sql
   echo "alter group jmoadmin add user $1"     >>/tmp/add.mdb.user.sql
   echo "\q"    >> /tmp/add.mdb.user.sql
   psql -f /tmp/add.mdb.user.sql mdb mdbadmin >> /tmp/add.mdb.user.out 2>&1
  }
 
  alias mdb_user_add='add_mdb_user'

alias mdb_user_add='add_mdb_user'

then typing mdb_user_add cadb you'll be able to add user 'cadb' to group jmoadmin in PostGresSQL