Created
March 13, 2011 07:24
-
-
Save justsee/867951 to your computer and use it in GitHub Desktop.
pg_hba.conf weirdness
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@localhost data]# service postgresql start | |
Starting postgresql service: [FAILED] | |
[root@localhost data]# cat pg_log/postgresql-Sat.log | |
LOG: could not open configuration file "/var/lib/pgsql/data/pg_hba.conf": Permission denied | |
FATAL: could not load pg_hba.conf | |
[root@localhost data]# ll | |
total 136 | |
drwx------ 7 postgres postgres 4096 Mar 12 23:19 base | |
drwx------ 2 postgres postgres 4096 Mar 12 23:20 global | |
drwx------ 2 postgres postgres 4096 Mar 12 23:18 pg_clog | |
-rw------- 1 postgres postgres 3411 Mar 12 23:19 pg_hba.conf | |
-rw------- 1 postgres postgres 1631 Mar 12 23:18 pg_ident.conf | |
drwx------ 2 postgres postgres 4096 Mar 12 23:19 pg_log | |
drwx------ 4 postgres postgres 4096 Mar 12 23:18 pg_multixact | |
drwx------ 2 postgres postgres 4096 Mar 12 23:20 pg_stat_tmp | |
drwx------ 2 postgres postgres 4096 Mar 12 23:18 pg_subtrans | |
drwx------ 2 postgres postgres 4096 Mar 12 23:18 pg_tblspc | |
drwx------ 2 postgres postgres 4096 Mar 12 23:18 pg_twophase | |
-rw------- 1 postgres postgres 4 Mar 12 23:18 PG_VERSION | |
drwx------ 3 postgres postgres 4096 Mar 12 23:18 pg_xlog | |
-rw------- 1 postgres postgres 16867 Mar 12 23:18 postgresql.conf | |
-rw------- 1 postgres postgres 57 Mar 12 23:22 postmaster.opts | |
[root@localhost data]# cat pg_hba.conf > new && mv pg_hba.conf pg_hba.conf.bak && \ | |
> mv new pg_hba.conf && chown postgres:postgres pg_hba.conf && chmod 600 pg_hba.conf && \ | |
> service postgresql start | |
Starting postgresql service: [ OK ] | |
[root@localhost data]# ll | |
total 152 | |
drwx------ 7 postgres postgres 4096 Mar 12 23:19 base | |
drwx------ 2 postgres postgres 4096 Mar 12 23:23 global | |
drwx------ 2 postgres postgres 4096 Mar 12 23:18 pg_clog | |
-rw------- 1 postgres postgres 3411 Mar 12 23:23 pg_hba.conf | |
-rw------- 1 postgres postgres 3411 Mar 12 23:19 pg_hba.conf.bak | |
-rw------- 1 postgres postgres 1631 Mar 12 23:18 pg_ident.conf | |
drwx------ 2 postgres postgres 4096 Mar 12 23:19 pg_log | |
drwx------ 4 postgres postgres 4096 Mar 12 23:18 pg_multixact | |
drwx------ 2 postgres postgres 4096 Mar 12 23:23 pg_stat_tmp | |
drwx------ 2 postgres postgres 4096 Mar 12 23:18 pg_subtrans | |
drwx------ 2 postgres postgres 4096 Mar 12 23:18 pg_tblspc | |
drwx------ 2 postgres postgres 4096 Mar 12 23:18 pg_twophase | |
-rw------- 1 postgres postgres 4 Mar 12 23:18 PG_VERSION | |
drwx------ 3 postgres postgres 4096 Mar 12 23:18 pg_xlog | |
-rw------- 1 postgres postgres 16867 Mar 12 23:18 postgresql.conf | |
-rw------- 1 postgres postgres 57 Mar 12 23:23 postmaster.opts | |
-rw------- 1 postgres postgres 46 Mar 12 23:23 postmaster.pid | |
[root@localhost data]# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I should note here that my issue was a result of SELinux being turned on by default in CentOS. I was using a Chef recipe to create the config files, and PostgreSQL would fail to start even though permissions appeared correct. I was baffled when I manually copied the same config file as above and PostgreSQL would start fine. I even KNEW SELinux can cause this exact trouble with unwitting devs, but had assumed it was disabled in my instance. Assuming things consistently undoes me!