Обсуждение: cannot connect using terminal nor pgaccess

Поиск
Список
Период
Сортировка

cannot connect using terminal nor pgaccess

От
Jaume Teixi
Дата:
$ psql -d template1 -U postgres
psql: Peer authentication failed for user 'postgres'


$ psql -d template1 -U postgres -h localhost -p 5432
psql: IDENT authentication failed for user 'postgres'

$ grep -v ^# /etc/postgresql/pg_hba.conf | grep -i sameuser
local        all                                           peer sameuser
host         all         127.0.0.1     255.255.255.0       ident sameuser

$ su - postgres -- psql template1
Password:
Welcome to psql, 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

template1=# select postgres from pg_user;
   usename   | usesysid | usecreatedb | usetrace | usesuper | usecatupd |
passwd  | valuntil
-------------+----------+-------------+----------+----------+-----------+----------+----------
 postgres    |       31 | t           | t        | t        | t         |
******** |


what I am missing in this case ?

thanks!

--
Jaume Teixi
    CTO
    6TEMS - Ducform, SA
    http://www.6tems.com


Re: cannot connect using terminal nor pgaccess

От
Peter Eisentraut
Дата:
Jaume Teixi writes:

> $ psql -d template1 -U postgres
> psql: Peer authentication failed for user 'postgres'

There is no "peer" authentication type in any official PostgreSQL release.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: cannot connect using terminal nor pgaccess

От
Tom Lane
Дата:
Jaume Teixi <teixi@6tems.com> writes:
> $ psql -d template1 -U postgres
> psql: Peer authentication failed for user 'postgres'

There is no such animal as "peer" authentication in Postgres.  Are you
using a locally hacked version?

            regards, tom lane

Re: cannot connect using terminal nor pgaccess

От
Jaume Teixi
Дата:
on day of Mon, 21 May 2001 17:00:19 +0200 (CEST), the message from Peter
Eisentraut <peter_e@gmx.net> says:

> Jaume Teixi writes:
>
> > $ psql -d template1 -U postgres
> > psql: Peer authentication failed for user 'postgres'
>
> There is no "peer" authentication type in any official PostgreSQL
release.

he, I hope this is the unix socket method that Olly is developing on the
current debian unstable release 7.1.1-3
isn't?

but why the tcp/ip also doesn't works ?

teixi@thinkpad:~$ grep -v ^# /etc/postgresql/pg_hba.conf | grep -i host

host         all         127.0.0.1     255.255.255.0       ident sameuser
host         all         0.0.0.0       0.0.0.0             reject

suid postgres works

teixi@thinkpad:~$ su - postgres -- psql template1

but without suid doesnt'

teixi@thinkpad:~$ psql -d template1 -U postgres -h localhost -p 5432
psql: IDENT authentication failed for user 'postgres'

any points ?

thanks

--
Jaume Teixi
    CTO
    6TEMS - Ducform, SA
    http://www.6tems.com

Re: cannot connect using terminal nor pgaccess

От
Peter Eisentraut
Дата:
Jaume Teixi writes:

> but why the tcp/ip also doesn't works ?
>
> teixi@thinkpad:~$ grep -v ^# /etc/postgresql/pg_hba.conf | grep -i host
>
> host         all         127.0.0.1     255.255.255.0       ident sameuser
                                                                   ^^^^^^^^
> host         all         0.0.0.0       0.0.0.0             reject

> teixi@thinkpad:~$ psql -d template1 -U postgres -h localhost -p 5432
  ^^^^^                                  ^^^^^^^^
> psql: IDENT authentication failed for user 'postgres'

"sameuser" means "same user".  Please read up on the details of ident
authentication.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: cannot connect using terminal nor pgaccess

От
Dronamraju Rajesh
Дата:
also try using -i option along with other options.
else all seems to be fine

regards,
Rajesh.

--- Jaume Teixi <teixi@6tems.com> wrote:
> $ psql -d template1 -U postgres
> psql: Peer authentication failed for user 'postgres'
>
>
> $ psql -d template1 -U postgres -h localhost -p 5432
> psql: IDENT authentication failed for user
> 'postgres'
>
> $ grep -v ^# /etc/postgresql/pg_hba.conf | grep -i
> sameuser
> local        all
>       peer sameuser
> host         all         127.0.0.1     255.255.255.0
>       ident sameuser
>
> $ su - postgres -- psql template1
> Password:
> Welcome to psql, 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
>
> template1=# select postgres from pg_user;
>    usename   | usesysid | usecreatedb | usetrace |
> usesuper | usecatupd |
> passwd  | valuntil
>
-------------+----------+-------------+----------+----------+-----------+----------+----------
>  postgres    |       31 | t           | t        | t
>        | t         |
> ******** |
>
>
> what I am missing in this case ?
>
> thanks!
>
> --
> Jaume Teixi
>     CTO
>     6TEMS - Ducform, SA
>     http://www.6tems.com
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the
> unregister command
>     (send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Re: cannot connect using terminal nor pgaccess

От
Peter Eisentraut
Дата:
Thalis A. Kalfigopoulos writes:

> I'm not that familiar with pg yet, but maybe his problem is with the auth line:
> host         all         127.0.0.1     255.255.255.0       ident sameuser
>
> How can an IP going through mask 255.255.255.0 yield x.x.x.1 ? Shouldn't the netmask be 255.255.255.255?

Since the error message was "ident authentication failed", this means that
the system has already decided to use ident authentication, which means
that the line was correct for that part.

As for the netmask, it doesn't matter.  See the documentation for the
precise logic.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: cannot connect using terminal nor pgaccess

От
"Thalis A. Kalfigopoulos"
Дата:
On Mon, 21 May 2001, Peter Eisentraut wrote:

> Jaume Teixi writes:
>
> > but why the tcp/ip also doesn't works ?
> >
> > teixi@thinkpad:~$ grep -v ^# /etc/postgresql/pg_hba.conf | grep -i host
> >
> > host         all         127.0.0.1     255.255.255.0       ident sameuser
>                                                                    ^^^^^^^^
> > host         all         0.0.0.0       0.0.0.0             reject
>
> > teixi@thinkpad:~$ psql -d template1 -U postgres -h localhost -p 5432
>   ^^^^^                                  ^^^^^^^^
> > psql: IDENT authentication failed for user 'postgres'
>
> "sameuser" means "same user".  Please read up on the details of ident
> authentication.
>
> --
> Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>

I'm not that familiar with pg yet, but maybe his problem is with the auth line:
host         all         127.0.0.1     255.255.255.0       ident sameuser

How can an IP going through mask 255.255.255.0 yield x.x.x.1 ? Shouldn't the netmask be 255.255.255.255?

regards,
thalis