Check out the GRANT nd REVOKE commands:
http://www.postgresql.org/docs/8.1/static/sql-grant.html
http://www.postgresql.org/docs/8.1/static/sql-revoke.html
You may want to do some revoking of PUBLIC rights followed by some
granting of rights to specific users on specific databases.
But, I don't think that the psql \c command allows you to bypass pg_hba
configuration, so I wonder if your pg_hba.conf file is broken - have you
tried psql <db1> <user2>? I am pretty sure that there is little or no
difference between:
psql <db1> <user2>
and
\c <db1> <user2>
Cheers,
Robin
KyLiE wrote:
Hi all, I'm quiet new in this stuff, I have N psql users and N
databases, each user has a database and can connect to it using his
psql account, however I don't want to allow that some user access to
another database that does not belong to him. I've modify my
pg_hba.conf file, and allow the access to the databases acording to
his owner, but once the user has connected to the DB it can change the
connection to another using this command : \c db1 user2, so my
question is, can I revoke commands?? or can I configure it per user??
or something??