Link to home
Start Free TrialLog in
Avatar of k_murli_krishna
k_murli_krishnaFlag for India

asked on

Creating & Adding User to Database in Linux

1) We have DB2 9 on Linux 8.2.4
2) Our GUI got disabled on reboot once
3) We have given root as installation user and another user for instance creation in db2 and das groups using which we created all databases
4) How to create a normal user in linux & for db2. To which group do we add him to
5) Since Control Center is no longer available how to add this user to database & give him only connect and DML privielges
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Hi k,

DB2 uses the host for authentication so if you create a unix/linux user you are also creating a Db2 user.

You can add users with the adduser command.  There are all kinds of options to adduser.  The simplest form should be fine:

  adduser -p NewPassword NewUser

or

  adduser --password NewPassword NewUser


DB2 recently announced support for Kerberos and a few other niceties so that it can tie authentication to things like the Microsoft Active Directory, but that's probably not something that you want to do yet.  The installation and setup certainly is not trivial.


Good Luck,
Kent
Missed the last question...

Use the GRANT statement to set up the user's permissions

GRANT CONNECT ON database TO USER NewUser;
GRANT CREATEIN ON SCHEMA schema TO USER NewUser;
GRANT ALL PRIVILEGES ON TABLE tablename TO USER NewUser;

Unless you've changed the defaults for the database, your users probably already are given at least this level of authority.


Kent
Avatar of k_murli_krishna

ASKER

Thanks, kdo. For creating normal user in windows, we just create a user and give 5-6 OS privileges to it. In linux, what is the equivalent of this. Which group do we assign the user into? The default one with its own name, db2grp or the das group? Please advise.
ASKER CERTIFIED SOLUTION
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, Kent. adduser command that you quoted is for linux. What I would like is a similar command to add user to any db2 database from command line. This is since GUI got disabled on our linux & hence control center is not opening up. This problem I will search to solve or ask in a separate post.
useradd is actual linux command. What I mean is in control center we add an user first and then grant connect on database to it. From command line if we just grant connect, will it be added as well?

I don't believe so, but I'm not sure.


Kent