3

I've spent lots of time to find Postgres configuration files like pg_hba.conf or postgresql.conf in different distributions of linux and also postgres versions itself! and I was very confused...

Vao Tsun
  • 42,665
  • 8
  • 85
  • 115
S.Hossein Asadollahi
  • 1,290
  • 1
  • 16
  • 22

2 Answers2

14

Finally I found the global solution for it.

First you should follow these steps:

  1. su - postgres
  2. psql
  3. For postgres configuration file:

    SHOW config_file;

the output should be like this:

postgres=# SHOW config_file;
                   config_file
    ------------------------------------------
     /etc/postgresql/9.6/main/postgresql.conf
    (1 row)

and for hba_file use:

SHOW hba_file;
S.Hossein Asadollahi
  • 1,290
  • 1
  • 16
  • 22
3

If you instance is not started and you can't

select current_setting('hba_file')

or

select setting from pg_settings where name = 'hba_file'

or

psql -c 'show hba_file'

you can just find them:

find / -name pg_hba.conf
Vao Tsun
  • 42,665
  • 8
  • 85
  • 115