Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

From, 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?

share|improve this question
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 Jun 1 '13 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 Jun 2 '13 at 8:39
up vote 0 down vote accepted

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:


    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.

share|improve this answer

You must log in to answer this question.

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