Search code examples
postgresqlcentospostgismapserverpg-hba.conf

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


I'm trying to run a MapServer 5/PostGIS installation on a Centos 6 virtual machine. I deployed MapServer in my cgi-bin folder, but now when I query (using firefox) mapserv file with the url [virtual machine local IP]/cgi-bin/mapserv?MAP=/var/www/cgi-bin/[...], all I get is an image with the following error message on it :

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'

I tried to change setting in pg_hba.conf with no luck. foo database can be accessed with foo as sql user and foo as password using psql command. What can I do ?


Solution

  • accordong to http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html change ident to md5 for user foo in hba.conf

    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.

    you can check which hba you use by psql to your db and running show hba_file ;