Difference between revisions of "PostgreSQL pg hba.conf"

From wikieduonline
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user 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 11: Line 13:
 
[[Amazon Linux 2]]:
 
[[Amazon Linux 2]]:
 
* <code>[[/usr/share/pgsql/pg_hba.conf.sample]]</code>
 
* <code>[[/usr/share/pgsql/pg_hba.conf.sample]]</code>
* <code>[[/var/lib/pgsql/data/pg_hba.conf]]</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
Line 52: Line 54:
  
 
== 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

pg_hba.conf client authentication configuration file.


Amazon Linux 2:

https://www.postgresql.org/docs/11/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SETTINGS


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]


Related terms[edit]

See also[edit]

  • https://stackoverflow.com/questions/18580066/how-to-allow-remote-access-to-postgresql-database
  • Advertising: