Обсуждение: Permissions to users ??? (FATAL: Ident authentication failed for user)

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

Permissions to users ??? (FATAL: Ident authentication failed for user)

От
"Ronni"
Дата:
Hi,

Im about to make a small webapplication using Postgresql.

My system is Debian 3.1 Sarge with Postgresql 8.1 from backports.org.

What I want to do is have my superuser, which also have a system account,
to create a database called wt, and then create two users (wt_public,
wt_admin) for use in the webapplication.

The two users for the webapplication should then have to following
permissions:
wt_public: only have permission to do a select, nothing else.
wt_admin: have all permissions on the database wt incl. creating and
dropping tables etc.

I've installed Postgresql and created my own superuser, and then, using my
superuser, I created the two users (wt_public, wt_admin)

I then created a database called wt, and added the following to pg_hba.conf:
host    wt          wt_admin    127.0.0.1/32          md5
host    wt          wt_public   127.0.0.1/32          md5

Then restarted postgresql and tried to login with:
psql -U wt_admin -W wt
but I get the following error:
psql: FATAL:  Ident authentication failed for user "wt_admin"


I have spent quite some time searching the net, reading and so on, but
cant seem to find anyting usefull on out how to give my users access to
the database.

All help is appriciated.

Regards
Ronni


Re: Permissions to users ??? (FATAL: Ident authentication failed for user)

От
Tom Lane
Дата:
"Ronni" <rofe@mailme.dk> writes:
> I then created a database called wt, and added the following to pg_hba.conf:
> host    wt          wt_admin    127.0.0.1/32          md5
> host    wt          wt_public   127.0.0.1/32          md5

> Then restarted postgresql and tried to login with:
> psql -U wt_admin -W wt
> but I get the following error:
> psql: FATAL:  Ident authentication failed for user "wt_admin"

Where did you put those lines in the pg_hba file?  I'll bet they are
after a more general line that specifies ident authorization.  pg_hba
is order-sensitive, see the docs.

            regards, tom lane

Re: Permissions to users ??? (FATAL: Ident authentication

От
"Ronni"
Дата:
> Where did you put those lines in the pg_hba file?  I'll bet they are
> after a more general line that specifies ident authorization.  pg_hba
> is order-sensitive, see the docs.
>

The bottom of my pg_hba.conf look like this:
------------------------------------------------------------------------------------
# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database
# super user can access the database using some other method.
# Noninteractive
# access to all databases is required during automatic maintenance
# (autovacuum, daily cronjob, replication, and similar tasks).
#
# Database administrative login by UNIX sockets
local   all         postgres                          ident sameuser

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               ident sameuser
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
host    wt          wt_admin    127.0.0.1/32          md5
host    wt          wt_public   127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               md5
# Reject all other connection attempts
host    all     all     0.0.0.0 0.0.0.0 reject
------------------------------------------------------------------------------------

And as you can see I put it under #IPv4 local connections:

I've tried to make a new user called web, grant all privileges on a table
in database wt, and added web like wt_admin above, with the same result, I
dont get to log in.

I made the users with createuser, and answered no to every question. My
own user, which I created the same way, but answered yes to every question
have no problems at all.

Regards
Ronni



> "Ronni" <rofe@mailme.dk> writes:
>> I then created a database called wt, and added the following to
>> pg_hba.conf:
>> host    wt          wt_admin    127.0.0.1/32          md5
>> host    wt          wt_public   127.0.0.1/32          md5
>
>> Then restarted postgresql and tried to login with:
>> psql -U wt_admin -W wt
>> but I get the following error:
>> psql: FATAL:  Ident authentication failed for user "wt_admin"
>
> Where did you put those lines in the pg_hba file?  I'll bet they are
> after a more general line that specifies ident authorization.  pg_hba
> is order-sensitive, see the docs.
>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>