PG_HBA(FILES)

NAME
$PGDATA/pg_hba — host-based access control

DESCRIPTION
Postgres provides host-based access control through the file pg_hba. This file is stored in $PGDATA and should have proper file permissions so that casual users cannot modify it. The file stores permissions information about which hosts are authorized to access databases.

The file consists of lines of three columns. The first column lists the name of the database. The second column lists the IP address of clients machines that are authorized to connect, and the third column provides a bit mask for the IP address. Lines which begin with '#' are considered comments.

The keyword "all" can be used to apply to all database names. Each column can contain strings of at most 80 characters, and each database may have up to 255 configuration lines that apply. (80 and 255 are constants that can be changed at Postgres compile time by altering the #defines MAX_TOKEN and MAX_LINES in src/backend/libpq/auth.c)

Below is the default pg_hba file that is installed.
#
# Example config file for Postgres95 host based access
#
# Lines starting with "all" apply to all databases.  Otherwise the first
# column has to match the name of the database being connected to.  Up to
# ten config lines can apply to each database.  Mask specifies bits that
# aren't counted. After those bits are taken out, the connection address
# must match the address in the middle column.
#
# <name>	<address>	<mask>
#
all		127.0.0.1	0.0.0.0

SEE ALSO
introduction(1).