本文介绍了“本地"和“本地"有什么区别?和“本地主机"pg_hba.conf 中的连接类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

This is the relevant part of my pg_hba.conf:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     ident
# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# IPv6 local connections:
host    all             all             ::1/128                 ident

The pidentd service is running.

When I try to log onto ee1 (I assume, the default user is postgres) :

psql ee1

It says "peer authentication failed for user postgres"

  1. Where have I configured peer authentication for "postgres" ? It's ident.

  2. When I change the following line in pg_hba.conf:

    local   all             all                                 ident
    

    to

    local   all             all                                 md5
    

    it asks me for a password, and I am able to log in. Why is it that making changes to the local connection type, have effect on postgres user?

解决方案

ident authentication means that your OS user matches DB user. It is support only for TCP/IP connections as relevant entry in docs states. If used with Unix socket, Peer authentication method will be used instead.

Also, note, that default user is not postgres, but the one you're currently logged in with.

这篇关于“本地"和“本地"有什么区别?和“本地主机"pg_hba.conf 中的连接类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 12:31