Re: Can't access to database from webapp in PostgreSQL 9.0, from shell it is Ok.

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Can't access to database from webapp in PostgreSQL 9.0, from shell it is Ok.
Date: 2011-12-02 23:36:58
Message-ID: 4ED9611A.7070505@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andre Lopes 2011-12-02 23:41:15 Re: Can't access to database from webapp in PostgreSQL 9.0, from shell it is Ok.
Previous Message Adrian Klaver 2011-12-02 23:34:57 Re: Can't access to database from webapp in PostgreSQL 9.0, from shell it is Ok.