Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1keKhc-0008G7-IT for pgsql-admin@arkaria.postgresql.org; Sun, 15 Nov 2020 16:16:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1keKha-0005Sk-By for pgsql-admin@arkaria.postgresql.org; Sun, 15 Nov 2020 16:16:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1keKha-0005Sd-2O for pgsql-admin@lists.postgresql.org; Sun, 15 Nov 2020 16:16:30 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1keKhT-0000IE-GQ for pgsql-admin@lists.postgresql.org; Sun, 15 Nov 2020 16:16:28 +0000 Received: by mail-ot1-x32a.google.com with SMTP id h16so9426470otq.9 for ; Sun, 15 Nov 2020 08:16:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=sWc/J2MdB/EFTshpqxVRqhelVHA2HxlBJcyP/R8LDQY=; b=od6RkPyE2b36+edn+xWqp8RbaORJPXxkEUBuIfzegSa67EN8UHF7lSKPxY8sb8+1AK FJaMybRDJqF6cMSxQndfSdYQNfRaP0pVGPiT219wKQgr5tCdqqT4cU7dsqZgNmTg/0DD 1B3LCS0KE0+vmkxl9hPneQrbitKjgz9XoroqQumH9DHT3RIO3k206FQ4ToqsgDOlay3S vot5ORWZjabh7qgKCn80DlwaCitGiUpNcciNOxF3xMb4EAXk/RrFmQkZFN8uVyXnL012 qREcp7XqaYDmYAAeYAuAew41uD7QhzSOGLghCmAHsVJAwtX3lgWIu5qlEpD63U4yiIdB cJsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=sWc/J2MdB/EFTshpqxVRqhelVHA2HxlBJcyP/R8LDQY=; b=mG5+bTQoaDUYGG1bJ5w05ndt3gHApnhV1NIbVJ9TbVasJTkQaJw5I/NJ8P/TGrjAAs fKf6ZMHV9lpiy5MxAj3ftlfgxvjJh3zOZMeNGHCUquymlC6PUd/9WMlkpD4P/of+mRLs 9OtIa/EuPEv1+aeLpByV/jcODp/DUexIIFM/MkyjkiTW0XGRys4od87VbwOyLIpLbk9k rO8XGy+2QRk28SviCg4SfZtTB85se/vvGjPznafCewPsLhFJiHyrzEcPu1RvC1dpzQaM QqfqMGWG5RJWd3ycKMW+eMuq8xDtD7ruqbBk/SqEt31EDCEDUIg9PGgNG36ObtwRGY+K gVow== X-Gm-Message-State: AOAM5306XQ614EVRMTlVFfyGTBXu6849KQ5XdtqmtuekXzyJQ3FkW3Zm 5bS+AtmMaYtJZp15y4Zo9KV1KAQoS1ZBew== X-Google-Smtp-Source: ABdhPJyg05MlNCYxn9pcZqtZRYBrVCc7QXl6sIow6xj6Z36zInpJDfOGDy0tNBg5hj93YpV07jjArA== X-Received: by 2002:a05:6830:831:: with SMTP id t17mr8346320ots.92.1605456982475; Sun, 15 Nov 2020 08:16:22 -0800 (PST) Received: from [192.168.1.10] (ip174-67-141-204.no.no.cox.net. [174.67.141.204]) by smtp.googlemail.com with ESMTPSA id 2sm3486684oir.40.2020.11.15.08.16.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 15 Nov 2020 08:16:21 -0800 (PST) Subject: Re: Create multiple users, to have all privileges on each others objects/relations To: pgsql-admin@lists.postgresql.org References: From: Ron Message-ID: Date: Sun, 15 Nov 2020 10:16:21 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------7F89CB4B9D55D72E4E53862D" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------7F89CB4B9D55D72E4E53862D Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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. --------------7F89CB4B9D55D72E4E53862D Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit 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.
--------------7F89CB4B9D55D72E4E53862D--