Monday, April 16, 2012

psql: FATAL: Peer authentication failed for user "xxx"

Authentication :

$ psql simpledb test
psql: FATAL:  Peer authentication failed for user "test"

The authentication service op postgresql has to be configured.

Example of configuration :

$ cd /etc/postgresql/9.1/main

$ diff pg_hba.conf pg_hba.conf.orig
< local   all    postgres                peer
< local   all    energycomm              md5
< #local  all    test                    md5
> local   all    postgres                peer
< #host   all    all     md5
< #host   all    all    trust
< host    all    all    samenet          md5
> host    all    all     md5

Restart postgresql :
$ service postgresql restart
 * Restarting PostgreSQL 9.1 database server  

postgres@vsolutions:/etc/postgresql/9.1/main$ psql simpledb test
Password for user test:
psql (9.1.3)
Type "help" for help.


1 comment: