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 1qBa7W-0004AN-E8 for pgsql-admin@arkaria.postgresql.org; Tue, 20 Jun 2023 12:06:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qBa7U-0005tH-VU for pgsql-admin@arkaria.postgresql.org; Tue, 20 Jun 2023 12:06:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBa7U-0005rj-Ka for pgsql-admin@lists.postgresql.org; Tue, 20 Jun 2023 12:06:00 +0000 Received: from mout-u-204.mailbox.org ([2001:67c:2050:101:465::204]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qBa7R-003cTX-RR for pgsql-admin@lists.postgresql.org; Tue, 20 Jun 2023 12:06:00 +0000 Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4Qllhf04fDz9sRw; Tue, 20 Jun 2023 14:05:54 +0200 (CEST) Date: Tue, 20 Jun 2023 14:05:53 +0200 (CEST) From: Erik Wienhold To: Phani Prathyush Somayajula , "pgsql-admin@lists.postgresql.org" Message-ID: <4796978.1031811.1687262753268@office.mailbox.org> In-Reply-To: References: Subject: Re: Restrict Write Users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Normal List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 20/06/2023 13:23 CEST Phani Prathyush Somayajula wrote: > > Is there a way to restrict write access to a user by restricting the user= to > have read-only on other databases on the instance. I=E2=80=99m using post= gresql-14 > version You should look into https://www.postgresql.org/docs/14/ddl-priv.html. Start with a user that has no privileges and grant additional privileges as necessary give read and/or write access. The user must not be the owner of database objects, must not be a member of an owner role, and must not be a superuser. Also check default privileges and privileges granted to PUBLI= C. But granting privileges in one database does not affect privileges in other databases, except for role memberships because roles are not tied to a spec= ific database. -- Erik