Re: Can't access to database from webapp in PostgreSQL 9.0, from shell it is Ok. - Mailing list pgsql-general

From John R Pierce
Subject Re: Can't access to database from webapp in PostgreSQL 9.0, from shell it is Ok.
Date
Msg-id 4ED9611A.7070505@hogranch.com
Whole thread Raw
In response to Can't access to database from webapp in PostgreSQL 9.0, from shell it is Ok.  (Andre Lopes <lopes80andre@gmail.com>)
List pgsql-general
On 12/02/11 3:13 PM, Andre Lopes wrote:
> [code]
> Exception Value:
> FATAL:  Ident authentication failed for user "mypoatgreuser"
> [/code]
>
> There is more permissions that I must to give to the user
> "mypoatgreuser"? What could be wrong here?

'ident' is the default authentication type for local domain socket
connections, and it means that user 'x' can only connect as postgresql
role 'x'.

A web app likely runs as httpd or webuser or some such, so ident
authentication isn't really applicable.

You control the authentication methods in the pg_hba.conf file.   I'd
suggest doing this...

1) set (and remember) passwords for all roles, including the "postgres"
default adminstrator role....

     ALTER ROLE postgres WITH PASSWORD 'somepassword';

2) configure pg_hba.conf as follows...

     local        all postgres                 ident
     local        all all                           md5

     host        all all   127.0.0.1/32    md5
     host        all all  (yoursubnet)     md5

and HUP the master postgres process (pg_ctl ... reload).

this way, the postgres user can authenticate locally with ident, but all
other users will require passwords.






--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Can't access to database from webapp in PostgreSQL 9.0, from shell it is Ok.
Next
From: Andre Lopes
Date:
Subject: Re: Can't access to database from webapp in PostgreSQL 9.0, from shell it is Ok.