X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 5A168CD153 for ; Sun, 20 Jul 2003 05:12:35 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 96892-07 for ; Sun, 20 Jul 2003 05:13:09 +0000 (GMT) Received: from Dude (unknown [65.103.207.190]) by svr1.postgresql.org (Postfix) with SMTP id 11FF0CD11F for ; Sun, 20 Jul 2003 02:12:31 -0300 (ADT) Received: (qmail 17843 invoked from network); 20 Jul 2003 05:13:06 -0000 Received: from Rh166.perfect-image.com (HELO perfect-image.com) () by perfect-image.com with SMTP; 20 Jul 2003 05:13:06 -0000 Message-ID: <3F1A24E4.2000806@perfect-image.com> Date: Sat, 19 Jul 2003 22:13:08 -0700 From: Ken Godee Reply-To: ken@perfect-image.com Organization: The Perfect Image User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5b) Gecko/20030716 Thunderbird/0.1a X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Arcadius A." Cc: pgsql-general@postgresql.org Subject: Re: Help with privilege or pg_hba.conf References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/904 X-Sequence-Number: 45757 Arcadius A. wrote: > Hello! > I have a Unix box running PostgreSQL 7.3.3. > > So far, I have been the only one user of the DB server...and I didn't have > any problem using it with the JDBC driver. > > Now, a friend of mine wants to use the DB too for doing web stuffs(PHP, > JSP).... so I need to create a new user on PostgreSQL. this has been done > easily. > Now, I don't want the new user (his username is "cool",and he has a > password ) to access other DBs on my server... I want him to access ONLY a > database named "cool" that he owns > (as user "cool", I have created the DB "cool"... and I want user "cool" to > access ONLY DB "cool" and do any operation on it). > > How can this be done? > > I've been trying to modify "pg_hba.conf" but with no luck .... as user > "cool", after I connect to the DB server via psql and I do "\c anotherdb", > user "cool" can still connect to "anotherdb". > my "pg_hba.conf" can be found at http://ahouans.sh.cvut.cz/pg_hba.txt > > Thanks in advance. > > Have a nice weekend! > > Arcadius Ahouansou. By creating a user "cool" you are allowing the user to connect to postgres and connect to any database. Though any user may connect to a database, if they wish access to objects within that database they must have those privileges explicitly granted to them. In other words if you didn't make "cool" a superuser (which you shouldn't of) or granted "cool" the right to create databases, "cool" will be able to connect to databases but that's it. "cool" won't be allowed to even select data or delete anything. If you create a database and make "cool" the owner, "cool" can then do whatever with only that database. As long as you create normal users you have to "Grant Privileges" to any new user to do anything, except connecting to databases. Read up on, "creating users" and "Granting Privileges". Or install the newest "pgaccess", it has a good gui for adding users/groups, displaying rights to objects and granting privileges.