Config postGreSQL pg_hba.conf restric role access

Posted by Mathias on Server Fault See other posts from Server Fault or by Mathias
Published on 2010-05-16T18:50:52Z Indexed on 2010/05/16 18:51 UTC
Read the original article Hit count: 282

Filed under:

Hello postgre experts.

I am completely new to the game but need the following:

I Create a new role with login. Let's say: User1

I then create a Database 'User1Database' and set User1 as the owner.

User1 has no rights to do anything except for access.

Now when I connect using User1 it somehow has access to all databases. I then learned I neeed to write something in here.

User1 should have global access to User1Database and absolutely no access to anything else.

What lines do I need to add to my pg_hba file?

Currently it looks like this:

# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               md5
host    all             all             0.0.0.0/0     md5

Hope someone can write me the exact lines and explain them to me.

© Server Fault or respective owner

Related posts about postgresql