2

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!

2 Answers 2

2

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.

7
  • everything runs on my ubuntu machine. Commented Oct 29, 2011 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" Commented Oct 29, 2011 at 14:02
  • however with pgadmin openerp user works... Commented Oct 29, 2011 at 14:06
  • Same database as well? Commented Oct 29, 2011 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. Commented Oct 29, 2011 at 14:41
1

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.