Linux Labs

Web stack / Stage 7 of 9

Connection, role and pg_hba

Not running Starting usually ~20 s
Leave the lesson

Step 7 of 7 · summary · 2 min

Summary

  • A connection goes through the network, the rule and the password; the refusal names the stage: Connection refused, no pg_hba.conf entry or rejects connection, password authentication failed.
  • A role is a PostgreSQL account; peer admits a Linux user over the socket to the role with the same name.
  • pg_hba.conf is read top to bottom, and the first matching line decides; a narrow rule is its own database, its own role, a /32 address and scram-sha-256.
  • Rules take effect after a reload without dropping connections; pg_hba_file_rules shows an error in the file.
  • The shop application from the start of the lesson got no pg_hba.conf entry: the service was running and listening on 5432, but the rules file had no line for shop.
Ubuntu 24.04
Loading…