Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id C74C19FB643 for ; Thu, 24 May 2007 15:31:56 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 36318-02-5 for ; Thu, 24 May 2007 15:31:39 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 9D0B59FBFFF for ; Thu, 24 May 2007 15:31:26 -0300 (ADT) Received: from [10.10.1.37] ([10.10.1.37]) by exchange.g2switchworks.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 24 May 2007 13:31:22 -0500 Message-ID: <4655D9FA.8010400@g2switchworks.com> Date: Thu, 24 May 2007 13:31:22 -0500 From: Scott Marlowe User-Agent: Thunderbird 1.5.0.4 (X11/20060516) MIME-Version: 1.0 To: Thomas Mack CC: pgsql-admin@postgresql.org Subject: Re: Role based database access References: <200705241042.40007.mack@ifis.cs.tu-bs.de> In-Reply-To: <200705241042.40007.mack@ifis.cs.tu-bs.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 24 May 2007 18:31:22.0414 (UTC) FILETIME=[BA9324E0:01C79E31] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/276 X-Sequence-Number: 25596 Thomas Mack wrote: > Hello! > > I face a problem here with restricting access to databases to > the owners of the database (Postgres 8.1.4). > > We would like any postgres user to have database access restricted > to their own databases only. This is so, as we use postgres for > educational purposes. > > I looked into pg_hba.conf, but unfortunately, when restricting > database access in the database field, the NAME(!) of the database > is concerned, which we do not restrict. Any user can create as > many databases as needed, and the name may be choosen freely. > > The 'user' field does not help in this either. > > So is there any chance to achieve what we need without revoking > the 'create database' permission and pre-creating the databases > for all our users? > > Thanks, > Thomas Mack > Does not the sameuser database name work for you in pg_hba.conf? I.e. you can only log into the database that bears your name.