Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

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

1 Answer 1

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:

    /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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.