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

Say you're seeing this message:

FATAL:  Ident authentication failed for user "..."

What are the causes of this error message?

share|improve this question

4 Answers 4

up vote 12 down vote accepted

It means that Postgres is trying to authenticate a user using the Ident protocol, and can't. Ident auth works like this:

  • You have database role 'foo' on database 'db'
  • Your pg_hba.conf file (in /etc/postgres-something/main) defines 'Ident' as the protocol to connect to database db for users connecting from certain hosts
  • The unix username making the connection is 'foo'
  • An Ident server running on the machine the user is connecting from confirms that their username really is 'foo'

Possible causes:

  1. There is no Ident server running on the machine you're trying to connect from. Test this by trying to connect to it on port 113. If that fails, install an Ident server (eg, sudo apt-get install oidentd).
  2. There's an Ident server, but the database role you're trying to connect to ('foo' in the above example) doesn't exist. So create it by connecting somehow to the database with superuser rights and do CREATE ROLE foo. Alternatively add an entry to /etc/postgresql/.../main/pg_ident.conf.
  3. Maybe the username connecting doesn't match the database role. You may be able to test this by connecting to the Ident server while a connection is going on, and passing the right port numbers.
  4. Maybe you actually want to connect with a password, not Ident. Edit the pg_hba.conf file appropriately. For example, change:

    host all all 127.0.0.1/32 ident
    

    to

    host all all 127.0.0.1/32 md5
    
share|improve this answer

Not sure about the causes, but this fixed it for me:

in pg_hba.conf

change to this:

host all all 127.0.0.1/32 md5

Exact error: Caused by: org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "postgres"

share|improve this answer
    
changing "ident" -> "md5" did it for me –  webwesen Sep 23 '13 at 19:54

On CentOS, add the following line to /var/lib/pgsql/9.3/data/pg_hba.conf:

host all all 127.0.0.1/32 trust

And comment out the other entries.

Of course, this setting is not secure, but if you're just messing about on a development VM like me then it's probably fine...

share|improve this answer

If you have not tried this already, review your pg_hba.conf file. It will be named something like /var/lib/pgsql/9.3/data/pg_hba.conf (Fedora 20); you may have to use 'find / -name pg_hba.conf' to locate it.

At the bottom of the file, change the 'METHOD' values to 'trust' for local testing (see postgres docs for full information). Reboot the machine to ensure everything is started clean and the new params are read.

Hopefully this will cure your woes. It solved my problems on Fedora 20 with PostgreSQL 9.3.

share|improve this answer
    
It's not necessary to reboot your entire machine when altering the PostgreSQL configs. Instead, try using pg_ctl reload from the console, or SELECT pg_reload_conf(); when executing SQL as a privileged user. –  benjwadams Oct 31 at 19:53

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.