Thread: How to assign multiple-users to a Postgres database?

How to assign multiple-users to a Postgres database?

From
KhunSanAung
Date:
Hi All,

I'm using Postgres database, and using the postGIS extensions for storing spatial datasets.

I can create a user and a database.
Currently I can assign one user as owner per one database and can login with pgAdminIII for administrating task.

I'd like to allow more than one user to edit the data.
Is it possible to create multiple users for a database?
How can I do it?

Thank you very much for any help.

--
Have a nice day!
--

Mr. Khun San Aung

Re: How to assign multiple-users to a Postgres database?

From
Yves Jacolin
Date:
On Monday, July 06, 2015 16:56:59 KhunSanAung wrote:
> Hi All,
>
> I'm using Postgres database, and using the postGIS extensions for storing
> spatial datasets.
>
> I can create a user and a database.
> Currently I can assign one user as owner per one database and can login
> with pgAdminIII for administrating task.
>
> I'd like to allow more than one user to edit the data.
> Is it possible to create multiple users for a database?
> How can I do it?
>
> Thank you very much for any help.
Hello,

A short answer: you should create a ROLE for each user and give some grant
access to the database (and probably to Scheme and Table):

The GRANT synopsis is:

GRANT { { CREATE | CONNECT | TEMPORARY | TEMP } [,...] | ALL [ PRIVILEGES ] }
    ON DATABASE database_name [, ...]
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

So, one example could be:

GRANT CONNECT ON DATABASE mydb TO yjacolin;

Regards,

Yves
--
Responsable Formation et Support
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel (France) : +33 4 58 48 20 43 (new !)
Tel (Suisse) : +41 21 619 10 43
Mob. : +33 6 18 75 42 21
Fax : 04 79 70 15 81
Mail : yves.jacolin@camptocamp.com
http://www.camptocamp.com