Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: cPanel overwriting pg_hba.conf file  (Read 4661 times)

0 Members and 1 Guest are viewing this topic.

joseletk

  • Guest
cPanel overwriting pg_hba.conf file
« on: April 28, 2018, 10:01:40 am »
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.

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

Code: [Select]
local all  all        md5
host samerole all  127.0.0.200   255.255.255.255   pam  pamservice=postgresql_cpses
host all all  127.0.0.1   255.255.255.255   md5
local all postgres        md5
host all postgres  127.0.0.1   255.255.255.255   md5

And setting it’s permissions to read-only:

Code: [Select]
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:

Code: [Select]
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:

Code: [Select]
/etc/init.d/postgresql-9.4 status
/etc/init.d/postgresql-9.4 restart
===========================================================================