Thread: psql: FATAL: Ident authentication failed for user "postgres"

psql: FATAL: Ident authentication failed for user "postgres"

From
VG
Date:
<div dir="ltr">Hi,<br /><br />I have installed postgresql-serve using yum <br />hba.conf group and owner were postgres
theni changed it to root.<br /><br />when i type psql -U postgres command ( as root  user) I get:<br />  <br /> psql:
FATAL: Ident authentication failed for user "postgres"<br /><br />My file permission are:<br />drwx------ 5 postgres
postgres 4096 2008-09-06 00:36 base<br />drwx------ 2 postgres postgres  4096 2008-09-08 21:44 global<br /> drwx------
2postgres postgres  4096 2008-09-06 00:36 pg_clog<br />-rw-r--r-- 1 postgres postgres  3200 2008-09-08 21:35
pg_hba.conf<br/>-rw------- 1 postgres postgres  1460 2008-09-06 00:36 pg_ident.conf<br />drwx------ 2 postgres
postgres 4096 2008-09-08 15:52 pg_log<br /> drwx------ 4 postgres postgres  4096 2008-09-06 00:36 pg_multixact<br
/>drwx------2 postgres postgres  4096 2008-09-06 00:36 pg_subtrans<br />drwx------ 2 postgres postgres  4096 2008-09-06
00:36pg_tblspc<br />drwx------ 2 postgres postgres  4096 2008-09-06 00:36 pg_twophase<br /> -rw------- 1 postgres
postgres    4 2008-09-06 00:36 PG_VERSION<br />drwx------ 3 postgres postgres  4096 2008-09-06 00:36 pg_xlog<br
/>-rw-------1 postgres postgres 15336 2008-09-06 00:36 postgresql.conf<br />-rw------- 1 postgres postgres    49
2008-09-0821:44 postmaster.opts<br /> -rw------- 1 postgres postgres    46 2008-09-08 21:44 postmaster.pid<br /><br
/>Howcould i achieve this..<br />Regards,<br />Vikas<br /><br /><br /></div> 

Re: psql: FATAL: Ident authentication failed for user "postgres"

From
"Filip Rembiałkowski"
Date:
2008/9/8 VG <vikasraigupta@gmail.com>:
> Hi,
>
> I have installed postgresql-serve using yum
> hba.conf group and owner were postgres then i changed it to root.
>
> when i type psql -U postgres command ( as root  user) I get:
>
> psql: FATAL:  Ident authentication failed for user "postgres"
>

read http://www.depesz.com/index.php/2007/10/04/ident/
what's in pg_hba.conf?



> My file permission are:
> drwx------ 5 postgres postgres  4096 2008-09-06 00:36 base
> drwx------ 2 postgres postgres  4096 2008-09-08 21:44 global
> drwx------ 2 postgres postgres  4096 2008-09-06 00:36 pg_clog
> -rw-r--r-- 1 postgres postgres  3200 2008-09-08 21:35 pg_hba.conf
> -rw------- 1 postgres postgres  1460 2008-09-06 00:36 pg_ident.conf
> drwx------ 2 postgres postgres  4096 2008-09-08 15:52 pg_log
> drwx------ 4 postgres postgres  4096 2008-09-06 00:36 pg_multixact
> drwx------ 2 postgres postgres  4096 2008-09-06 00:36 pg_subtrans
> drwx------ 2 postgres postgres  4096 2008-09-06 00:36 pg_tblspc
> drwx------ 2 postgres postgres  4096 2008-09-06 00:36 pg_twophase
> -rw------- 1 postgres postgres     4 2008-09-06 00:36 PG_VERSION
> drwx------ 3 postgres postgres  4096 2008-09-06 00:36 pg_xlog
> -rw------- 1 postgres postgres 15336 2008-09-06 00:36 postgresql.conf
> -rw------- 1 postgres postgres    49 2008-09-08 21:44 postmaster.opts
> -rw------- 1 postgres postgres    46 2008-09-08 21:44 postmaster.pid
>
> How could i achieve this..
> Regards,
> Vikas
>
>
>



--
Filip Rembiałkowski

Re: psql: FATAL: Ident authentication failed for user "postgres"

From
"Milen A. Radev"
Date:
VG написа:
> Hi,
> 
> I have installed postgresql-serve using yum
> hba.conf group and owner were postgres then i changed it to root.

Why?

> 
> when i type psql -U postgres command ( as root  user) I get:
> 
> psql: FATAL:  Ident authentication failed for user "postgres"


Most probably the default pg_hba.conf includes the following line:
local   all         postgres                          ident

Which means that you could login with the DB user "postgres" only if you
are logged in already as the system user "postgres". So "su - postgres"
before using psql should do the trick.

Please read "Chapter 21. Client Authentication"
(http://www.postgresql.org/docs/current/static/client-authentication.html)
for details.


-- 
Milen A. Radev



Re: psql: FATAL: Ident authentication failed for user "postgres"

From
Devrim GÜNDÜZ
Date:
On Mon, 2008-09-08 at 15:39 +0530, VG wrote:
> hba.conf group and owner were postgres then i changed it to root.
>
> when i type psql -U postgres command ( as root  user) I get:
>
> psql: FATAL:  Ident authentication failed for user "postgres"

First, revert the owner/group change.

Then, su - postgres    and then run psql.

Or:

Edit pg_hba.conf, and write

trust

instead of "ident sameuser" -- then reload PostgreSQL

As root: service postgresql reload
or as postgres user: pg_ctl reload

Ownership of pg_hba.conf has nothing to do with the authentication.

Regards,

--
Devrim GÜNDÜZ, RHCE
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr                  http://www.gunduz.org