0

From http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html, it says:

A default pg_hba.conf file is installed when the data directory is initialized by initdb.

I would assume when I run initdb, it will generate a file at /var/lib/pgsql/9.1/data/pg_hba.conf. However, it also generates a file at /var/lib/pgsql/pg_hba.conf.

  1. Could anyone explain how do I end up with two pg_hba.conf with different content?

  2. Which one eventually will be used?

2
  • Could you post the output of ls -l /var/lib/pgsql/9.1/data/pg_hba.conf /var/lib/pgsql/pg_hba.conf? Is one a link to the other? Also check if they are different: diff /var/lib/pgsql/pg_hba.conf /var/lib/pgsql/9.1/data/pg_hba.conf
    – terdon
    Commented Jun 1, 2013 at 20:54
  • Thanks @terdon! Following your lead, I figured out the problem. The problem was I did not correctly override the pg_hba.conf, which results in two pg_hba.conf.
    – Mingyu
    Commented Jun 2, 2013 at 8:39

1 Answer 1

0

Finally, I figured out the problem:

I was using Vagrant to create the Virtual Machine, and using Puppet to install postgresql-9.1. The puppet has a postgresql-service module, which includes two parts that are relevant to this question:

  1. initdb, which essentially runs:

    /sbin/service postgresql-9.1 initdb
    

    The result of this command is to create the directory:

    /var/lib/pgsql/9.1/data
    

    Inside this directory, there is a default pg_hba.conf

  2. Override the default pg_hba.conf with our customized pg_hba.conf

    The problem I had was I output customized pg_hba.conf to /var/lib/pgsql instead of /var/lib/pgsql/9.1/data.

Hope the answer will help other people to avoid similar problems.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .