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

From: Yves Jacolin <yves(dot)jacolin(at)camptocamp(dot)com>
To: pgsql-admin(at)postgresql(dot)org, KhunSanAung(dot)GIS(at)gmail(dot)com
Subject: Re: How to assign multiple-users to a Postgres database?
Date: 2015-07-06 11:27:24
Message-ID: 9642342.zDFveqarPE@tatras
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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(dot)jacolin(at)camptocamp(dot)com
http://www.camptocamp.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Igor Neyman 2015-07-06 13:22:28 Re: pg_upgrade
Previous Message KhunSanAung 2015-07-06 10:26:59 How to assign multiple-users to a Postgres database?