PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 18th, 2002, 10:46 PM
ggnanaraj ggnanaraj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Chennai, India
Posts: 69 ggnanaraj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 55 sec
Reputation Power: 11
How restrict users to a database ?

I need to restrict users access to a database.

Say, 'user1' can access only database 'db1'
'user2' can access database 'db2'
'user3' can access databases 'db1' & 'db2'

Can I do this using any configuration file, like pg_hba.conf, etc.?

Thanks for the input.

Regards.

Reply With Quote
  #2  
Old October 19th, 2002, 08:33 AM
def def is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: UA
Posts: 2 def User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
pg_ident.conf & pg_hba.conf

If you do not want use GRANT and REVOKE,
you can use pg_ident.conf and pg_hba.conf



pg_hda.conf
--

host db1 0.0.0.0 0.0.0.0 ident i1
host db2 0.0.0.0 0.0.0.0 ident i2


pg_ident.conf
--

i1 user1 postgres
i1 user3 postgres
i2 user2 postgres
i2 user3 postgres


----
Sincerely,
Andrew A.Romanchenko
Programmer of Rapid Internet Development Department
Alar Information Technologies, URL

Reply With Quote
  #3  
Old October 20th, 2002, 03:09 PM
niyogi niyogi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Austin,TX
Posts: 62 niyogi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 55 sec
Reputation Power: 0
an easy way to do this is to simply create the database as the user you'd like to restrict the database to

-niyogi

PostgreSQL web Hosting http://www.pghoster.com

Reply With Quote
  #4  
Old October 21st, 2002, 12:11 AM
ggnanaraj ggnanaraj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Chennai, India
Posts: 69 ggnanaraj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 55 sec
Reputation Power: 11
From what I see, pg_ident.conf is only a mapping of OS usernames to PostgreSQL usernames. Correct me if I am wrong.

However, what I need is a mapping of database username to databases...

For eg., if 'u_hris' is database username and
if 'hris' & 'dev' are PostgreSQL databases...

... I need a mapping of PostgreSQL username 'u_hris' to PostgreSQL database 'hris'.

Thanks.

Last edited by ggnanaraj : October 21st, 2002 at 05:31 AM.

Reply With Quote
  #5  
Old October 21st, 2002, 04:31 AM
Ted Striker Ted Striker is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 409 Ted Striker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
Only database users that have been granted explicit access to the database with GRANT can access that database. By default, nobody can access a database unless you tell them they can.

It will be something like this:


GRANT ALL ON hris TO u_hris

or

GRANT SELECT ON hris TO u_hris

etc, etc,

http://www.postgresql.org/idocs/ind...privileges.html

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > How restrict users to a database ?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap