0

I setup posgresql on centos. I'm trying to access it but I receive an error:

sudo -u postgres psql -c "ALTER USER john WITH PASSWORD 'mypass';"
[sudo] password for john:
could not change directory to "/home/john"
ALTER ROLE
psql -h localhost -U john -d proddb -W
Password for user john:
psql: FATAL:  Ident authentication failed for user "john"

I've listed the users with 'du' and know that john is a superuser. Can someone tell me why this is happening and how to fix it?

max
  • 9,708
  • 15
  • 89
  • 144
  • Yes. It's the same question. However, the answer was unclear on the previous posts. I've made it clear what the problem is in my straight forward answer. If you're an admin, you can go ahead and move my answer to that post and close this one. – max Apr 26 '15 at 03:09

1 Answers1

1

I replaced ident with password in pg_hba.conf, then restarted the postgres service and now it works. ident option uses the system credentials while 'password' option will use un-encrypted password.

max
  • 9,708
  • 15
  • 89
  • 144