[lug] PostgresSQL user mapping question

Glenn Murray gmurray at mines.edu
Fri Sep 27 15:42:35 MDT 2002


I am a newbie to db administration and ran into a PostgreSQL problem.
I have an program called "ocw" which uses PostgreSQL 7.2.

When folks download and run ocw they need to create and populate a
PostgreSQL database.  I thought the best way to do this is to have a
PostgreSQL user ocw which they would create as user postgres using
createuser.  Is there a better way?  Right now the only way I can make
this work is to have each downloader create a PostgreSQL with his or
her own user name and have them edit a properties file from which ocw
can pick up that name.

Trying the ocw name didn't work.  User postgres can create user ocw
with permission to create databases, but as user glenn or postgres:

postgres:~$ createdb -U ocw ocwdb
psql: FATAL 1:  IDENT authentication failed for user "ocw"

I tried the following lines in pg_hba.conf, restarting postgresql each time,
# TYPE	DATABASE	IP_ADDRESS	MASK		AUTH_TYPE  AUTH_ARGUMENT
local	all		                                trust      OCW
#host    all		                                trust      OCW
#local	all		127.0.0.1	255.255.255.255 trust      OCW
#host    all		127.0.0.1	255.255.255.255 trust      OCW

and the following in pg_ident.conf:
# MAP     IDENT    PGUSERNAME
OCW	glenn		ocw
OCW 	postgres	ocw
OCW	glenn	 	postgres
OCW	ocw		postgres

Any advice would be appreciated.

Thanks,
Glenn Murray
http://www.mines.edu/~gmurray




More information about the LUG mailing list