FATAL:  Ident authentication failed for user "test-postgres"

So I have a postgres server hosting a side of my database access for my Rails application and I have a database for production set up and a user for production set up but I keep getting the previous error whenever I try to view my Rails application from a browser. Can somebody help me out? I have the postgres user created and the database created already...

migrated from stackoverflow.com Jun 10 '13 at 20:47

This question came from our site for professional and enthusiast programmers.

  • Did you do a Google search for the error message? Also: PostgreSQL version, how you set PostgreSQL up, server OS and version, etc etc. – Craig Ringer Jun 10 '13 at 3:13
  • 8.4 postgres version, ubuntu 10.04 for server version, yes but every time i google for the answer to this question i just get the same answer which is create the user and create the database to have it initialize. the database and the user are created though so i dont know what to do. i just used aptitude to install postgresql. – Ben Nelson Jun 10 '13 at 3:15

Read the Ubuntu documentation on their PostgreSQL packages, which you'll find in /usr/share/doc . Alternately, there's a nice wiki page on it here: https://help.ubuntu.com/community/PostgreSQL (first hit for "ubuntu postgresql").

You have a pg_hba.conf file that's set to try to use ident authentication for host (TCP/IP) connections, but you don't have an identd running or you're trying to connect as a different PostgreSQL user to your unix username.

You need to set a paassword for the user and change the authentication method to md5. See the client authentication chapter of the documentation.

(A truly definitive answer would be easier to make if you'd given the command you ran to get that error).

  • i just was trying to view my rails application from the web and that's when i get that error, wasn't any command i was using specifically. i have set the ident authentication method to trust on every local connection but it still throws that error. is there anything else i should be doing? – Ben Nelson Jun 10 '13 at 19:50
  • I also can't connect with "psql -d myDb -U username -W" – Ben Nelson Jun 10 '13 at 19:52
  • The following however does work: "psql -U test-postgres -h localhost -d test-postgres_production" – Ben Nelson Jun 10 '13 at 20:07
  • i'm dumb! fixed it! you were right – Ben Nelson Jun 10 '13 at 20:29

You can almost certainly overcome this by changing the local line in pga_hba.conf

If you change the column ident to trust, it will make this problem go away.

I'm sure some people would have a security concern, but from my perspective, if someone has already got access to your server, a password for the database isn't gonna be much help.

http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html I know this isn't the same version of Postgres, but the concept hasn't really changed.

Hope this helps.

  • <code> local all postgres trust local all test-postgres trust # TYPE DATABASE USER CIDR-ADDRESS METHOD # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all trust # IPv6 local connections: host all all ::1/128 md5 </code> – Ben Nelson Jun 10 '13 at 19:48
  • that is what i changed my pga_hba.conf file to but i still get the same error... – Ben Nelson Jun 10 '13 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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