Thursday, April 04, 2013

postgres add user

1. useradd user1

2. vi /var/lib/pgsql/data/pg_hba.conf

#add the user the user ip address with authentication like this

host    all         all         10.1.19.12/32           md5

3. su - postgres

createuser user1

3. last step is to add the user to the db

alter user user1 with encrypted password 'XXXXXX';

4. grant all on tablex to user1 

or run these on the db
select 'grant all on '||schemaname||'.'||tablename||' to bar;' from pg_tables where schemaname in ('public') order by schemaname, tablename;

No comments: