MapServer error : FATAL: Ident authentication failed for user "..."

MapServer error : FATAL: Ident authentication failed for user "..."

我正在尝试 运行 在 Centos 6 虚拟机上安装 MapServer 5/PostGIS。 我在我的 cgi-bin 文件夹中部署了 MapServer,但现在当我查询(使用 firefox)mapserv 文件时 使用 url [virtual machine local IP]/cgi-bin/mapserv?MAP=/var/www/cgi-bin/[...],我得到的只是一张带有以下错误消息的图像:

msDrawMap(): Image handling error. Failed to draw layer named '[name of my layer]'.;msPostGISLayerOpen(): Query error. Database connection failed (FATAL: ident authentification failed for user "foo") with connect string 'user=foo dbname=foo password=foo host=localhost port=5432'

我尝试更改 pg_hba.conf 中的设置,但没有成功。 可以使用 foo 作为 sql 用户和 foo 作为密码使用 psql 命令访问 foo 数据库。 我能做什么?

根据http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.htmlhba.conf

中的用户 fooident 更改为 md5

Obtain the operating system user name of the client by contacting the ident server on the client and check if it matches the requested database user name. Ident authentication can only be used on TCP/IP connections. When specified for local connections, peer authentication will be used instead. See Section 19.3.5 for details.

您可以通过 psql 和 运行 show hba_file ;

检查您使用的是哪个 hba