Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I installed Postgres on Ubuntu.

Via pgAdmin i can connect Postgres with a user i created BUT when i try other application that use the same user name and password I get : Ident authentication failed for user.

Why via pgAdmin i can connect and via a python client i get the above error message ?

Thanks!

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

ident works by checking which system user is trying to connect, and allows it to connect with that as its criteria. Network can be added as a criteria as well.

A few points to guide on troubleshooting the issue:

  • Are you 100% sure that the part that initiates the connection is running within the context of the user you want to authenticate as?
  • Is the python client providing the same username?
  • Is it running as a different user (through sudo, for example)?
  • Are you running pgAdmin and the python client on the same host, so we can rule out other differences as a factor?
  • Is the python client connecting to the same address as pgAdmin (External address vs. localhost address)?

Configuring Postgresql to use remote authentication based with md5/sha1 is probably the easiest way to reliably fix this. It will allow authentication by other users, if they know the password - but you should have control of who knows the password anyway.

share|improve this answer
    
everything runs on my ubuntu machine. –  Cris Oct 29 '11 at 14:00
    
i am using openerp which tries to connect to the local postgresbut i get this [2011-10-29 16:05:06,912][template1] ERROR:db.connection_pool:Connection to the database failed Traceback (most recent call last): File "/home/cristi/openerp/server/bin/sql_db.py", line 303, in borrow result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection) OperationalError: FATAL: Ident authentication failed for user "openerp" –  Cris Oct 29 '11 at 14:02
    
however with pgadmin openerp user works... –  Cris Oct 29 '11 at 14:06
    
Same database as well? –  Kvisle Oct 29 '11 at 14:16
1  
Looks like pgadmin might be connecting via localhost, and python via unix socket. I'm also thinking you are connecting to different databases (ie. template1 vs postgres) If that's not it, can you show your pg_hba.conf settings, and the dsn for both. –  xzilla Oct 29 '11 at 14:41
show 2 more comments

Check if you are using the same 'hostname' for the phpPgAdmin and the other method.

It makes difference if you use localhost or 127.0.0.1 or public/internal server IP as a connection hostname.

share|improve this answer
add comment

Your Answer

 
discard

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.