Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My settings:

  • Ubuntu 9.10
  • PostgreSQL 8.4.2

I created a new user(jdoe) under my local PostgreSQL with the following command in the psql shell:


I also have created a new database called mydb. My goal is to give user jdoe full access to database mydb. I did a few things through the GUI pgAdmin III and after running \l in the psql shell, I get the following output:

                                    List of databases
Name     |  Owner   | Encoding |  Collation  |    Ctype    |   Access privileges
mydb     | jdoe     | UTF8     | en_CA.UTF-8 | en_CA.UTF-8 | =CTc/mydb
                                                           : hmart=CTc/mydb
postgres | postgres | UTF8     | en_CA.UTF-8 | en_CA.UTF-8 | 

Showing my list of users(\du), I get:

            List of roles
 Role name | Attributes  | Member of 
 jdoe      |             | {}
 postgres  | Superuser   | {}
           : Create role   
           : Create DB    

I can't really tell from the above if my goal has been achieved, but is there a way to test if the user jdoe can communicate with the database mydb? I'm testing it though Django's settings:

DATABASE_ENGINE = 'postgresql_psycopg2'           
DATABASE_NAME = 'mydb'      
DATABASE_USER = 'jdoe'       
DATABASE_PASSWORD = 'password'        
DATABASE_HOST = ''         

but I'm getting the following error after a python syncdb:

psycopg2.OperationalError: FATAL:  Ident authentication failed for user "jdoe"

I did all the above on Win XP with the latest PostgreSQL installer and everything work flawlessly with Django. I'm not sure what I'm missing under Ubuntu.

share|improve this question
up vote 2 down vote accepted

You probably have set it up in pg_hba.conf so that local socket connections must use ident authorization, while tcp connections to localhost are trusted. Read the documentation on pg_hba.conf for your version, eg 8.4 is here, and you can configure it correctly for your situation.

share|improve this answer

This is weird, setting DATABASE_HOST to localhost fix the issue:

DATABASE_HOST = 'localhost'
share|improve this answer
See above re pg_hba and tcp sockets vs unix domain sockets. – Tobu Jun 29 '10 at 11:54
For some very strange reason this solved the problem for me – Sevenearths Feb 14 '12 at 12:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.