Access and Encryption for PostgreSQL DBAs
Access and encryption is controlling who can connect to PostgreSQL and protecting data in transit and at rest. It covers roles and privileges, pg_hba.conf rules, SCRAM-SHA-256 authentication, row-level security, TLS and auditing with pgaudit. It is the main security stage of the PostgreSQL DBA path.
Stage: Security · Part of the PostgreSQL DBA roadmap · Last reviewed 19 November 2026
What to learn in Access and Encryption
- Create group roles and grant least-privilege access to schemas and tables
- Configure pg_hba.conf to require scram-sha-256 over TLS for remote hosts
- Enable TLS with a server certificate and verify that clients validate it
- Write a row-level security policy that restricts rows per user or tenant
- Enable pgaudit to log DDL and privileged statements
Access and Encryption interview questions
Why prefer scram-sha-256 over md5 password authentication?
SCRAM never sends the password or a reusable hash over the wire, resists replay and stores a salted, iterated verifier, whereas md5 uses a weak hash that is easy to attack if captured. md5 authentication is deprecated in recent releases.
How does row-level security work in PostgreSQL?
You enable RLS on a table and create policies with USING and WITH CHECK expressions, often comparing a column to current_user or a session setting. Queries then see or modify only matching rows. Superusers and BYPASSRLS roles skip it, and table owners do too unless FORCE ROW LEVEL SECURITY is set.
Where Access and Encryption fits in the PostgreSQL DBA roadmap
Access and Encryption belongs to the Security stage (intermediate level), which takes about 4 hours. Lock it down.
Other units in this stage
Back to the full PostgreSQL DBA roadmap