Re: Connect error - Mailing list pgsql-novice

From Bruno Wolff III
Subject Re: Connect error
Date
Msg-id 20040112175742.GA27922@wolff.to
Whole thread Raw
In response to Re: Connect error  (Bill Moseley <moseley@hank.org>)
Responses Re: [Ignor Whois] Re: Connect error
List pgsql-novice
On Mon, Jan 12, 2004 at 09:29:00 -0800,
  Bill Moseley <moseley@hank.org> wrote:
>
> I was not able to get this configuration working, so I think I'm not
> understanding the documentation correctly.  Or maybe I was expecting
> that "sameuser" would work:

sameuser says that the os username must match the postgres username.

> moseley@bumby:~$ createdb newdb
> CREATE DATABASE
>
> moseley@bumby:~$ psql newdb
> Welcome to psql 7.4.1, the PostgreSQL interactive terminal.
>
> Type:  \copyright for distribution terms
>        \h for help with SQL commands
>        \? for help on internal slash commands
>        \g or terminate with semicolon to execute query
>        \q to quit
>
> newdb=> \q
>
> moseley@bumby:~$ su
> Password:
>
> bumby:/home/moseley# fgrep moseley /etc/postgresql/pg_ident.conf
> sameuser      www-data    moseley

Since sameuser is a special ident map you can't use it as a named map in
the pg_ident.conf map.

>
> bumby:/home/moseley# /etc/init.d/postgresql restart
> Stopping PostgreSQL database server: postmaster.
> Starting PostgreSQL database server: postmaster.
>
> bumby:/home/moseley# su www-data
>
> bumby:/home/moseley$ psql newdb
> psql: FATAL:  user "www-data" does not exist
>
> bumby:/home/moseley$ psql -Umoseley newdb
> psql: FATAL:  IDENT authentication failed for user "moseley"
>
>
> I even tried using my own map name instead of "sameuser".
>
> bumby:/etc/postgresql# fgrep testmap pg_hba.conf pg_ident.conf
> pg_hba.conf:host    all         all         127.0.0.1         255.255.255.255   ident testmap
> pg_ident.conf:testmap      moseley  www-data
>
> So I think I'm missing an important concept.

I think you are pretty close. In the last case you enabled ident authentication
using testmap for internet connections, but unless you did this for local
connections (domain sockets) as well, it wouldn't apply since the way you
are using psql will use a domain socket to connect (unless you have set
the PGHOST environment variable).

>
>
>
>
> --
> Bill Moseley
> moseley@hank.org
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings

pgsql-novice by date:

Previous
From: Bill Moseley
Date:
Subject: Re: Connect error
Next
From: Bill Moseley
Date:
Subject: Re: [Ignor Whois] Re: Connect error