Difference between revisions of "PostgreSQL pg hba.conf"
Jump to navigation
Jump to search
↑ https://stackoverflow.com/questions/18580066/how-to-allow-remote-access-to-postgresql-database
(12 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
https://www.postgresql.org/docs/current/auth-pg-hba-conf.html | https://www.postgresql.org/docs/current/auth-pg-hba-conf.html | ||
+ | |||
+ | * HBA Host Based [[Authentication]] | ||
<code>[[pg_hba.conf]]</code> client [[authentication]] configuration file. | <code>[[pg_hba.conf]]</code> client [[authentication]] configuration file. | ||
Line 8: | Line 10: | ||
* <code> /etc/postgresql/10/main/pg_hba.conf</code> | * <code> /etc/postgresql/10/main/pg_hba.conf</code> | ||
+ | |||
+ | [[Amazon Linux 2]]: | ||
+ | * <code>[[/usr/share/pgsql/pg_hba.conf.sample]]</code> | ||
+ | * <code>[[/var/lib/pgsql/data/pg_hba.conf]]</code> (<code>[[sudo service postgresql initdb]]</code>) | ||
https://www.postgresql.org/docs/11/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SETTINGS | https://www.postgresql.org/docs/11/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SETTINGS | ||
− | listen_addresses | + | |
− | + | * <code>[[listen_addresses]]</code> | |
+ | * <code>listen_addresses 0.0.0.0</code> | ||
Line 34: | Line 41: | ||
host replication all 127.0.0.1/32 md5 | host replication all 127.0.0.1/32 md5 | ||
host replication all ::1/128 md5 | host replication all ::1/128 md5 | ||
+ | |||
+ | == Errors == | ||
+ | * <code>[Nest] 41 - 09/27/2022, 10:12:12 PM ERROR [ExceptionHandler] [[no pg_hba.conf entry for host]] "20.10.2.58", user "your-user", database "your-db", SSL off</code> | ||
+ | * <code>[[no pg_hba.conf entry for host]]</code> | ||
+ | |||
== Related terms == | == Related terms == | ||
Line 39: | Line 51: | ||
* <code>[[/etc/postgresql/12/main/postgresql.conf]]</code> | * <code>[[/etc/postgresql/12/main/postgresql.conf]]</code> | ||
* <code>[[$HOME/.pg_service.conf]]</code> | * <code>[[$HOME/.pg_service.conf]]</code> | ||
− | * <code>[ | + | * <code>[[ident]]</code> |
− | |||
== See also == | == See also == | ||
+ | * {{pg_hba.conf}} | ||
* {{PostgreSQL}} | * {{PostgreSQL}} | ||
[[Category:PosgreSQL]] | [[Category:PosgreSQL]] |
Latest revision as of 15:14, 3 February 2023
https://www.postgresql.org/docs/current/auth-pg-hba-conf.html
- HBA Host Based Authentication
pg_hba.conf
client authentication configuration file.
/etc/postgresql/14/main/pg_hba.conf
/etc/postgresql/13/main/pg_hba.conf
/etc/postgresql/12/main/pg_hba.conf
/etc/postgresql/11/main/pg_hba.conf
/etc/postgresql/10/main/pg_hba.conf
/usr/share/pgsql/pg_hba.conf.sample
/var/lib/pgsql/data/pg_hba.conf
(sudo service postgresql initdb
)
https://www.postgresql.org/docs/11/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SETTINGS
listen_addresses
listen_addresses 0.0.0.0
Remote communication[edit]
cat /etc/postgresql/*/main/pg_hba.conf | grep -v "#" | grep . local all postgres peer local all all peer host all all 127.0.0.1/32 md5 host all all ::1/128 md5 local replication all peer host replication all 127.0.0.1/32 md5 host replication all ::1/128 md5
To allow remote communications from all IPs [1]:
/etc/postgresql/*/main/pg_hba.conf local all postgres peer local all all peer host all all 0.0.0.0/0 md5 host all all ::/0 md5 local replication all peer host replication all 127.0.0.1/32 md5 host replication all ::1/128 md5
Errors[edit]
[Nest] 41 - 09/27/2022, 10:12:12 PM ERROR [ExceptionHandler] no pg_hba.conf entry for host "20.10.2.58", user "your-user", database "your-db", SSL off
no pg_hba.conf entry for host
Related terms[edit]
psql
command line cli and.psqlrc
configuration file/etc/postgresql/12/main/postgresql.conf
$HOME/.pg_service.conf
ident
See also[edit]
pg_hba.conf, peer, md5
- PostgreSQL:
pg_dump, pg_restore
,pgAdmin, pg_config, psql, pg_ctl, pg_isready, initdb
, Role, Schema, DBeaver, Navicat, DataGrip, OmniDB,Adminer
, docker-compose.xml PostgreSQL, PostgreSQL version, PostgreSQL logs,postgresql.conf
,pg_hba.conf, $HOME/.pg_service.conf
, Create database (PostgreSQL), Create user,createdb
,GRANT
,pg_stat
, PostgreSQL VACUUM, EXPLAIN,pg stat activity
, Autovacuum, ALTER DATABASE, PostgreSQL statistics collector, Shared buffers, EXPLAIN (PostgreSQL),EXPLAIN ANALYZE
, Bitmap scan,EXPLAIN VERBOSE
,EXPLAIN VERBOSE (PostgresSQL)
,WAL
,ALTER USER
,CREATE ROLE, CREATE USER
,\du
,show users
,\l
, The Statistics Collector, pganalyze,cron.schedule
, Master,pg_tables
, PostgreSQL replication,CREATE, SET
, TOAST, PgBouncer, Restore DB, Index, meta-commands, Table, foreign table, Schema, Sequence, Views, materialized view, Table Partitioning, monitoring, PostgreSQL System Administration Functions, PostgreSQL extension, privileges, logging, PGTune, PostgreSQL parameter tunning, PostgreSQL modules, pgbench, PostgreSQL users, catalogs
Advertising: