All HowTo's PostgreSQL

cPanel overwriting my pg_hba.conf file

This article describes and solves (work-around) a problems with PostgreSQL and cPanel. The issue is that cPanel modifies the file “/var/lib/pgsql/9.4/data/pg_hba.conf” setting it back to a default state.

This article has more information:

By setting that file to your liking such as the following:

local all  all        md5
host samerole all   pam  pamservice=postgresql_cpses
host all all   md5
local all postgres        md5
host all postgres   md5

And setting it’s permissions to read-only:

chattr -ia /var/lib/pgsql/9.4/data/pg_hba.conf

If you need to make future changes to the above file, first reset it’s permissions using the following:

chattr +ia /var/lib/pgsql/9.4/data/pg_hba.conf

You should be able to move on without cPanel tripping you over in future.

You’ll need to restart PostgreSQL:

/etc/init.d/postgresql-9.4 status
/etc/init.d/postgresql-9.4 restart

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *