Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qQtGx-001JKR-HJ for pgsql-general@arkaria.postgresql.org; Tue, 01 Aug 2023 17:35:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qQtGu-008jcu-Nb for pgsql-general@arkaria.postgresql.org; Tue, 01 Aug 2023 17:35:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qQtGu-008jcm-D0 for pgsql-general@lists.postgresql.org; Tue, 01 Aug 2023 17:35:01 +0000 Received: from smtp69.ord1d.emailsrvr.com ([184.106.54.69]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qQtGs-000DrZ-VX for pgsql-general@lists.postgresql.org; Tue, 01 Aug 2023 17:35:00 +0000 X-Auth-ID: xof@thebuild.com Received: by smtp17.relay.ord1d.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 8B0F42014F; Tue, 1 Aug 2023 13:34:57 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: Sample pg_hba.conf allows local users to access all databases From: Christophe Pettus In-Reply-To: <07a0ac4f2b98152f355c64e967763924@cyberfusion.nl> Date: Tue, 1 Aug 2023 10:34:54 -0700 Cc: pgsql-general@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <1B165218-5DEF-45C7-8442-B6DC80EEB10D@thebuild.com> References: <07a0ac4f2b98152f355c64e967763924@cyberfusion.nl> To: William Edwards X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Classification-ID: 57384178-41a0-4642-b33c-8147aab7938b-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Aug 1, 2023, at 10:13, William Edwards = wrote: > This allows all local users connecting over TCP to access all = databases, not only the databases that the user is a member of as one = might expect. There's really no notion of a user being "a member of" a database in = PostgreSQL. Users are global resources, which are either granted access = to a particular database, or aren't. In your example, you explicitly grant access to the databases to the = users you are creating. Since a default installation of PostgreSQL contains only one superuser = role, and the `postgres` database, any other access requires specific = intervention on the part of someone with a superuser account.=