Re: Connecting with PostgreSQL 9.1 using the Ubuntu machine user and peer authentication method

From: Jorge Arevalo <jorgearevalo(at)libregis(dot)org>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Connecting with PostgreSQL 9.1 using the Ubuntu machine user and peer authentication method
Date: 2014-08-07 08:39:47
Message-ID: CAMhtMNOdHXuqof6zHh1MidQZN+Mhhx6o2=8kMPkdBTNoO9YkOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Aug 7, 2014 at 1:14 AM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 08/06/2014 03:43 PM, Jorge Arevalo wrote:
>
>> Hello,
>>
>> I want to connect to my local installation of PostgreSQL 9.1 using my
>> machine user (who is vagrant). So, after reading PostgreSQL
>> documentation, I thought I just needed to:
>>
>> 1. Add username map in pg_ident.conf:
>>
>> # MAPNAME SYSTEM-USERNAME PG-USERNAME
>>
>> vp vagrant postgres
>>
>>
>> 2. Using the map in pg_hba.conf
>>
>> # TYPE DATABASE USER ADDRESS METHOD
>>
>> local all all
>> peer map=vp
>>
>> But I'm getting the error
>>
>> sql: FATAL: Peer authentication failed for user "vagrant"
>>
>> If I try to connect to my server using psql.
>>
>> I guess I'm misunderstanding the PostgreSQL manual. But, how could I get
>> what I need? (locally connect with the user vagrant like if it was the
>> postgres user)
>>
>>
> What OS are you on?
>
> Per:
> http://www.postgresql.org/docs/9.1/interactive/auth-methods.html#AUTH-PEER
>
> "Peer authentication is only available on operating systems providing the
> getpeereid() function, the SO_PEERCRED socket parameter, or similar
> mechanisms. Currently that includes Linux, most flavors of BSD including
> Mac OS X, and Solaris."
>
>
>
Linux system (Ubuntu 12.04). Also tested in Mac OS 10.8.

Forgot to mention: in pg_hba.conf there is a previous line:

local postgres peer

No map specified for that line.

>
>
>> --
>> Jorge Arevalo
>>
>> http://about.me/jorgeas80
>>
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>

--
Jorge Arevalo
Freelance developer

http://about.me/jorgeas80

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Russell Keane 2014-08-07 08:42:13 Upgrading 9.0 to 9.3 - permission denied to pg_upgrade_utility.log
Previous Message Guillaume Lelarge 2014-08-07 07:37:20 Re: Questions on dynamic execution and sqlca