pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ident auth does not works as  usual
6+ messages / 4 participants
[nested] [flat]

* ident auth does not works as  usual
@ 2023-08-26 09:31  pan snowave <windxp@LIVE.CN>
  0 siblings, 2 replies; 6+ messages in thread

From: pan snowave @ 2023-08-26 09:31 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Well  , describe as follows:

pg_pba.conf
host    all             root             127.0.0.1/32           ident    map=test
host    all             all             127.0.0.1/32            trust


pg_indent.conf

test   root    cce


and  login pg  via  root  user , it doesnt work

error info is

2023-08-26 16:56:29.484 CST [18349] LOG:  no match in usermap "test" for user "root" authenticated as "root"
2023-08-26 16:56:29.484 CST [18349] FATAL:  Ident authentication failed for user "root"
2023-08-26 16:56:29.484 CST [18349] DETAIL:  Connection matched pg_hba.conf line 91: "host    all             root             127.0.0.1/32           ident    map=test"


i checked config file  many times, and could not find  any reason  of this error.

pls help me.

thanks.





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: ident auth does not works as  usual
@ 2023-08-26 10:38  Alban Hertroys <haramrae@gmail.com>
  parent: pan snowave <windxp@LIVE.CN>
  1 sibling, 1 reply; 6+ messages in thread

From: Alban Hertroys @ 2023-08-26 10:38 UTC (permalink / raw)
  To: pan snowave <windxp@LIVE.CN>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>


> On 26 Aug 2023, at 11:31, pan snowave <windxp@LIVE.CN> wrote:

(…)

> pg_indent.conf
> 
> test   root    cce

If that is indeed the name of the file, that would explain your problem. No doubt that it should be named pg_ident.conf instead, without the ’n'.

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.






^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: ident auth does not works as usual
@ 2023-08-26 14:43  David G. Johnston <david.g.johnston@gmail.com>
  parent: pan snowave <windxp@LIVE.CN>
  1 sibling, 1 reply; 6+ messages in thread

From: David G. Johnston @ 2023-08-26 14:43 UTC (permalink / raw)
  To: pan snowave <windxp@live.cn>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On Saturday, August 26, 2023, pan snowave <windxp@live.cn> wrote:

> Well  , describe as follows:
>
> pg_pba.conf
> host    all             root             127.0.0.1/32           ident
>  map=test
> host    all             all             127.0.0.1/32            trust
>
>
> pg_indent.conf
>
> test   root    cce
>
>
> and  login pg  via  root  user , it doesnt work
>

You are saying root os user can login as pg role cce but that line of the
pg_hba.conf doesn’t permit cce to login.  In short, the mapping is useless.

David J.

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: ident auth does not works as usual
@ 2023-08-28 03:47  David G. Johnston <david.g.johnston@gmail.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: David G. Johnston @ 2023-08-28 03:47 UTC (permalink / raw)
  To: pan snowave <windxp@live.cn>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On Sunday, August 27, 2023, pan snowave <windxp@live.cn> wrote:

> Hi
>
> "Show your psql command that is failing."
>
> [root@~ pg]# /usr/local/pgsql/bin/psql   -p5432 -d db1     -h127.0.0.1
> psql: error: connection to server at "127.0.0.1", port 5432 failed: FATAL:
>  Ident authentication failed for user "root"
>
> If the error is  Ident authentication failed for user "*cce*", i think
> the ident config file taked effect.
>

What about your psql command is supposed to inform the system that you want
to login at the db role cce?  The ident file doesn’t magically alias one
name to another, it’s purpose is to allow some OS user to specify some
other name to use to authenticate instead of the OS user they are executing
the command with.

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: ident auth does not works as usual
@ 2023-08-28 14:44  David G. Johnston <david.g.johnston@gmail.com>
  parent: Alban Hertroys <haramrae@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: David G. Johnston @ 2023-08-28 14:44 UTC (permalink / raw)
  To: pan snowave <windxp@live.cn>; +Cc: Alban Hertroys <haramrae@gmail.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On Mon, Aug 28, 2023 at 7:34 AM pan snowave <windxp@live.cn> wrote:

> But when i connect to psserver by using os user root
> /usr/local/pgsql/bin/psql   -p5432 -d db1     -h127.0.0.1
>

If you want to login as the cce role add " -U cce " to your command line
(or one of the various other ways you can specify a db role name via the
cli or libpq)

psql -U cce -h 127.0.0.1 -d db1

Keep in mind you could very well have two lines in your pg_ident.conf file:

test root cce
test root ddf

David J.

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* 回复: ident auth does not works as usual
@ 2023-09-19 03:46  pan snowave <windxp@live.cn>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: pan snowave @ 2023-09-19 03:46 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Alban Hertroys <haramrae@gmail.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

HI

I've got the  right meanng of pg_hba.conf and pg_ident.conf.

My previous understanding was incorrect. I thought pgserver would automatically handle the conversion between OS users and PostgreSQL roles.

Thanks all.


________________________________
发件人: David G. Johnston <david.g.johnston@gmail.com>
发送时间: 2023年8月28日 14:44
收件人: pan snowave <windxp@live.cn>
抄送: Alban Hertroys <haramrae@gmail.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
主题: Re: ident auth does not works as usual

On Mon, Aug 28, 2023 at 7:34 AM pan snowave <windxp@live.cn<mailto:windxp@live.cn>> wrote:
But when i connect to psserver by using os user root
/usr/local/pgsql/bin/psql   -p5432 -d db1     -h127.0.0.1

If you want to login as the cce role add " -U cce " to your command line (or one of the various other ways you can specify a db role name via the cli or libpq)

psql -U cce -h 127.0.0.1 -d db1

Keep in mind you could very well have two lines in your pg_ident.conf file:

test root cce
test root ddf

David J.


^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2023-09-19 03:46 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-08-26 09:31 ident auth does not works as  usual pan snowave <windxp@LIVE.CN>
2023-08-26 10:38 ` Alban Hertroys <haramrae@gmail.com>
2023-08-28 14:44   ` Re: ident auth does not works as usual David G. Johnston <david.g.johnston@gmail.com>
2023-09-19 03:46     ` 回复: ident auth does not works as usual pan snowave <windxp@live.cn>
2023-08-26 14:43 ` Re: ident auth does not works as usual David G. Johnston <david.g.johnston@gmail.com>
2023-08-28 03:47   ` Re: ident auth does not works as usual David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox