Mapping users in PostgreSQL

View: New views
3 Messages — Rating Filter:   Alert me  

Mapping users in PostgreSQL

by Jorge Arévalo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I'm trying to map linux users with database users. When I rebuild
PostGIS source code, I'd like to perform "make check" with my user.

So, I have this line in pg_hba.conf file:

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
   local    all                   all
                ident map=mymap

And in pg_ident.conf file:
# MAPNAME     IDENT-USERNAME    PG-USERNAME
   mymap           jorge                            gis

"jorge" is my Linux user, and "gis" is my database user.

But I always get an authentication fail if I try a direct connection
with "psql" and my user. The log file doesn't show any error.

Any suggestion?

Thanks in advance.

Best regards,
Jorge
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

Re: Mapping users in PostgreSQL

by Tom Lane-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

=?UTF-8?Q?Jorge_Ar=C3=A9valo?= <jorge.arevalo@...> writes:
> And in pg_ident.conf file:
> # MAPNAME     IDENT-USERNAME    PG-USERNAME
>    mymap           jorge                            gis

> "jorge" is my Linux user, and "gis" is my database user.

> But I always get an authentication fail if I try a direct connection
> with "psql" and my user. The log file doesn't show any error.

You're misunderstanding what identmap does.  That line says that OS user
"jorge" is *allowed* to connect as database user "gis".  It doesn't
magically substitute that username, though, and psql doesn't know any
better than to send "jorge" as the database username.  You could do
"psql -U gis", or set PGUSER in your environment.

                        regards, tom lane
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

Re: Mapping users in PostgreSQL

by Jorge Arévalo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Nov 8, 2009 at 3:10 AM, Tom Lane <tgl@...> wrote:

> =?UTF-8?Q?Jorge_Ar=C3=A9valo?= <jorge.arevalo@...> writes:
>> And in pg_ident.conf file:
>> # MAPNAME     IDENT-USERNAME    PG-USERNAME
>>    mymap           jorge                            gis
>
>> "jorge" is my Linux user, and "gis" is my database user.
>
>> But I always get an authentication fail if I try a direct connection
>> with "psql" and my user. The log file doesn't show any error.
>
> You're misunderstanding what identmap does.  That line says that OS user
> "jorge" is *allowed* to connect as database user "gis".  It doesn't
> magically substitute that username, though, and psql doesn't know any
> better than to send "jorge" as the database username.  You could do
> "psql -U gis", or set PGUSER in your environment.
>
>                        regards, tom lane
> _______________________________________________
> postgis-devel mailing list
> postgis-devel@...
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>

Many thanks Tom! I've defined PGUSER and PGHOST properly and
everything works. I'll read more carefully the doc.

Best regards,
Jorge
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel