DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · File Locations

hba_file

Sets the server's "hba" configuration file.

  • Default: '' (empty)
  • Type: string
  • Applies: Restart required

In plain words

Where to find pg_hba.conf, the file that decides who may connect from where, to which database, and how they must authenticate (password, certificate, peer …). By default it is in the data directory.

For DBAs and operators

Only settable at server start (postgresql.conf or command line), but the contents of the file are re-read on reload (SELECT pg_reload_conf(); or pg_ctl reload). A file with errors is not loaded at reload: the old rules stay in effect and the error is logged.

SHOW hba_file;
SELECT line_number, type, database, user_name, address, auth_method, error
  FROM pg_hba_file_rules;

pg_hba_file_rules parses the file as it is now on disk, so you can check for mistakes before reloading. Rules are matched top to bottom, first match wins. A refused connection logs e.g. FATAL: no pg_hba.conf entry for host "10.0.0.5", user "app", database "shop", no encryption. Replication connections need lines with replication in the database column.

How to change it

Change in postgresql.conf or ALTER SYSTEM, then restart the server.

See it in context

Client authentication Physical layout on disk

Related parameters

ident_file config_file data_directory

All File Locations parameters