You will have to edit your
pg_hba.conf file. If you really want to reduce possible access to a single user (see the note below), you will need the following lines, and only these:
# TYPE DATABASE USER ADDRESS METHOD
host all dbowner all md5
local all dbowner md5
This means that only
dbowner will have access to any DB, logging in via the Unix socket or a TCP connection (from all addresses, including
localhost). You can replace 'all' with your DB name if you want to limit access to a single DB.
After having edited the file, you will have to reload the config - depending on your system, do a
pg_ctl reload or
kill -HUP <postmaster_pid>, or do this form inside the DB, by calling
Please note that in the future you might want to do certain things that need rights
dbowner may not have (be it
CREATEUSER or something else). Depending on the policy you follow, you'll have to edit the file again to allow further access to a user (eg.
postgres) that has the necessary privileges, or you have to assign these to
dbowner before closing the door on other users.