Skip to Content

Install, connect and secure

sudo apt install postgresql
sudo -u postgres psql
\l      -- databases      \du  -- roles      \dt -- tables      \q -- quit
  • Server config: postgresql.conf; who may connect: pg_hba.conf
  • Listen only where needed: listen_addresses = 'localhost,192.168.10.40'
  • In pg_hba.conf use scram-sha-256, restrict by subnet, never trust on a network line
  • One role per application with only the rights it needs:
CREATE ROLE app LOGIN PASSWORD '…';
CREATE DATABASE appdb OWNER app;
Rating
0 0

There are no comments for now.

to be the first to leave a comment.