Обсуждение: Connecting with PostgreSQL 9.1 using the Ubuntu machine user and peer authentication method
Connecting with PostgreSQL 9.1 using the Ubuntu machine user and peer authentication method
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)
Many thanks in advance (and sorry for the cross-posting. I asked this in serverfault too, but I think this is the right place)
Jorge Arevalo
http://about.me/jorgeas80
and make sure you restarted the server so your changes take effect.
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-USERNAMEvp vagrant postgres
2. Using the map in pg_hba.conf
# TYPE DATABASE USER ADDRESS METHODlocal 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)Many thanks in advance (and sorry for the cross-posting. I asked this in serverfault too, but I think this is the right place)
--
Jorge Arevalo
http://about.me/jorgeas80
On 8/6/2014 3:43 PM, Jorge Arevalo wrote: > > 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: > wouldn't it be easier to ... create user vagrant superuser; create database vagrant owner vagrant; ? -- john r pierce 37N 122W somewhere on the middle of the left coast
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." > > -- > Jorge Arevalo > > http://about.me/jorgeas80 -- Adrian Klaver adrian.klaver@aklaver.com
On 08/06/2014 03:43 PM, Jorge Arevalo wrote:What OS are you on?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)
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."
--
Adrian Klaver
adrian.klaver@aklaver.com
Jorge Arevalo
Freelance developer
http://about.me/jorgeas80
On 8/6/2014 3:43 PM, Jorge Arevalo wrote:wouldn't it be easier to ...
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:
create user vagrant superuser;
create database vagrant owner vagrant;
?
--
john r pierce 37N 122W
somewhere on the middle of the left coast
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
That's an option, yes. I just wanted to avoid the creation of a new superuser, if I can identify my vagrant machine user with db postgres user
Jorge Arevalo
Freelance developer
http://about.me/jorgeas80
and make sure you restarted the server so your changes take effect.
Вложения
On 08/07/2014 01:39 AM, Jorge Arevalo wrote: > > What OS are you on? > > Per: > http://www.postgresql.org/__docs/9.1/interactive/auth-__methods.html#AUTH-PEER > <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 That would be the issue, assuming you are doing something along lines of psql -d some_db -U postgres per: http://www.postgresql.org/docs/9.1/interactive/auth-pg-hba-conf.html " The first record with a matching connection type, client address, requested database, and user name is used to perform authentication. There is no "fall-through" or "backup": if one record is chosen and the authentication fails, subsequent records are not considered." If you are not connecting as above, you will need to show us your connection string. > > No map specified for that line. > > > > -- > Jorge Arevalo > -- Adrian Klaver adrian.klaver@aklaver.com
On 08/07/2014 01:39 AM, Jorge Arevalo wrote:http://www.postgresql.org/__docs/9.1/interactive/auth-__methods.html#AUTH-PEER
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
That would be the issue, assuming you are doing something along lines of psql -d some_db -U postgres per:
http://www.postgresql.org/docs/9.1/interactive/auth-pg-hba-conf.html
" The first record with a matching connection type, client address, requested database, and user name is used to perform authentication. There is no "fall-through" or "backup": if one record is chosen and the authentication fails, subsequent records are not considered."
If you are not connecting as above, you will need to show us your connection string.
--
No map specified for that line.
--
Jorge Arevalo
Adrian Klaver
adrian.klaver@aklaver.com