[Techtalk] postgres authentication

Katherine Spice k.spice at acu.ac.uk
Tue Nov 1 04:06:10 EST 2005


Hi Cass,

At the bottom of the pg_hba.conf should be a line that looks like this:

# TYPE	DATABASE	USER	  IP-ADDRESS	IP-MASK	  METHOD

Below it try the following

local   dbname		username			  md5

replacing dbname and username with the parameters for your system.

TYPE can be local (as in localhost) or host (as in remote system).
For local, IP-ADDRESS and IP-MASK are left blank, for host they combine
to define allowed hosts.

METHOD is what is used to authenticate. For a webapp using a username
and password I use md5 but I think postgres supports others as well. For
system users I use ident sameuser.

More detail can be got here
http://www.postgresql.org/docs/7.4/interactive/client-authentication.html

You then need to make sure that the username you have specified exists
in postgres eg CREATE USER cass WITH PASSWORD 'linux' (see
http://www.postgresql.org/docs/7.4/interactive/sql-createuser.html for
more info).

Finally, run "pg_ctl reload" to make the postmaster reread the file
before you try to connect.

I hope this helps,
Katherine


Caroline Johnston wrote:
> Hi chix,
> 
> I'm trying to set up a postgres database for a web app on FC3 and I'm
> stuck with the authentication system. I've had a look at pg_hba.conf
> and played around with it but I don't seem to be able to get it working.
> All I want is to be able to log into a specific database with a specific
> username and password from my webapp (which will be running as apache, or
> me for testing). Can anyone tell me what entry I need in pg_hba.conf?
> 
> Many thanks,
> 
> Cass
> 
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://linuxchix.org/cgi-bin/mailman/listinfo/techtalk




More information about the Techtalk mailing list