pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedCreate multiple users, to have all privileges on each others objects/relations
3+ messages / 3 participants
[nested] [flat]
* Create multiple users, to have all privileges on each others objects/relations
@ 2020-11-15 15:46 otar shavadze <oshavadze@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: otar shavadze @ 2020-11-15 15:46 UTC (permalink / raw)
To: pgsql-admin
Hello,
How can create multi users so, that they all have permissions on each
others DB objects ?
What I did (From "postgres" user):
CREATE ROLE postgres_subuser1 PASSWORD 'some_password';
CREATE ROLE postgres_subuser2 PASSWORD 'some_password';
ALTER DEFAULT PRIVILEGES FOR ROLE postgres_subuser1 GRANT ALL PRIVILEGES ON
TABLES TO postgres_subuser1;
ALTER DEFAULT PRIVILEGES FOR ROLE postgres_subuser2 GRANT ALL PRIVILEGES ON
TABLES TO postgres_subuser2;
Then I logged in with "postgres_subuser1" and created table "table1".
Then I logged in with "postgres_subuser2" and tried: "SELECT COUNT(*) FROM
table1". This gives error: "permission denied for table table1"
Tell please, What is my mistake?
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Create multiple users, to have all privileges on each others objects/relations
@ 2020-11-15 16:16 Ron <ronljohnsonjr@gmail.com>
parent: otar shavadze <oshavadze@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Ron @ 2020-11-15 16:16 UTC (permalink / raw)
To: pgsql-admin@lists.postgresql.org
On 11/15/20 9:46 AM, otar shavadze wrote:
> Hello,
> How can create multi users so, that they all have permissions on each
> others DB objects ?
> What I did (From "postgres" user):
>
> CREATE ROLE postgres_subuser1 PASSWORD 'some_password';
> CREATE ROLE postgres_subuser2 PASSWORD 'some_password';
>
> ALTER DEFAULT PRIVILEGES FOR ROLE postgres_subuser1 GRANT ALL PRIVILEGES
> ON TABLES TO postgres_subuser1;
> ALTER DEFAULT PRIVILEGES FOR ROLE postgres_subuser2 GRANT ALL PRIVILEGES
> ON TABLES TO postgres_subuser2;
>
>
> Then I logged in with "postgres_subuser1" and created table "table1".
> Then I logged in with "postgres_subuser2" and tried: "SELECT COUNT(*)
> FROM table1". This gives error: "|permission denied for table table1"
>
> |Tell please, What is my mistake?
Try creating a "group" role, and then "user" roles which inherit from the
"group" role.
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Create multiple users, to have all privileges on each others objects/relations
@ 2020-11-15 20:30 David G. Johnston <david.g.johnston@gmail.com>
parent: Ron <ronljohnsonjr@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: David G. Johnston @ 2020-11-15 20:30 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
On Sunday, November 15, 2020, Ron <ronljohnsonjr@gmail.com> wrote:
> On 11/15/20 9:46 AM, otar shavadze wrote:
>
> How can create multi users so, that they all have permissions on each
> others DB objects ?
>
>
> ALTER DEFAULT PRIVILEGES FOR ROLE postgres_subuser1 GRANT ALL PRIVILEGES
> ON TABLES TO postgres_subuser1;
> ALTER DEFAULT PRIVILEGES FOR ROLE postgres_subuser2 GRANT ALL PRIVILEGES
> ON TABLES TO postgres_subuser2;
>
> Tell please, What is my mistake?
>
> You aren’t cross-authorizing: the context role and target role in each
command is the same role.
>
> Try creating a "group" role, and then "user" roles which inherit from the
> "group" role.
>
>
That is indeed the more common way of accomplishing the stated goal.
David J.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2020-11-15 20:30 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-15 15:46 Create multiple users, to have all privileges on each others objects/relations otar shavadze <oshavadze@gmail.com>
2020-11-15 16:16 ` Ron <ronljohnsonjr@gmail.com>
2020-11-15 20:30 ` David G. Johnston <david.g.johnston@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox