3

I have issue with postgres. It stops due to change in pg_hba.conf file

Actually my postgres was not connect with PHP

So I change in method in /var/lib/pgsql/data/pg_hba.conf file:

TYPE     DATABASE           USER            ADDRESS                 METHOD
host       all              all             127.0.0.1/32            ident

In order to solve my connection error i change the method ident to trust and postgresql servicer stops

I rollback my changes even it not started.

The error is:

LOG: could not open configuration file "/var/lib/pgsql/9.4/data/pg_hba.conf": Permission denied

6
  • PostgreSQL version? What's the error message from the PostgreSQL log files when you try to start it? Commented May 20, 2015 at 4:57
  • 1
    Please add the error from the log. Commented May 20, 2015 at 5:13
  • PostgreSQL version is 9.4 Commented May 20, 2015 at 5:26
  • When I start service with /etc/init.d/postgresql-9.4 start, It shows failed Commented May 20, 2015 at 5:27
  • How to check error log. I am using cent-os Commented May 20, 2015 at 5:31

1 Answer 1

5

I'm assuming that postgresql is running with postgres user, as in a standard configuration.

From terminal, as root:

ls -l /var/lib/pgsql/9.3/data/pg_hba.conf

And verify the owner. If the owner is not postgres:

chown postgres:postgres pg_hba.conf

And be sure it has permission to read and write:

chmod u+rwx pg_hba.conf
Sign up to request clarification or add additional context in comments.

10 Comments

ThankX to reply, I always login with postgres user so user is postgres and I change the pg_hba.conf file permission even it is not started
Is currently postgresql running with postgres user? How did you edit configuration file? (gedit, vi, ecc...)
I change method ident to trust and it stops then I rollback the change but not started then
Problem is gedit if it is on a remote machine (it rewrites the file, messing up permissions). Just login via shell and verify permission. I'm pretty sure problem is there.
How to do that dear plz let me know
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.