Thread: Create multiple users, to have all privileges on each others objects/relations
Create multiple users, to have all privileges on each others objects/relations
From
otar shavadze
Date:
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: "
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?
On 11/15/20 9:46 AM, otar shavadze wrote:
Try creating a "group" role, and then "user" roles which inherit from the "group" role.
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.
Angular momentum makes the world go 'round.
Re: Create multiple users, to have all privileges on each others objects/relations
From
"David G. Johnston"
Date:
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.