1

When opening the psql console, there is no password prompt. This behaviour is the same for all postgres users. I can basically do everything without a password. This seems rather unsafe.

How do I enable password checking? I'm running macOS Mojave and use Postgres.app with postgresql version 10.

This is the command I use:

psql -Umyuser # this user has a password set
  • 1
    In lieu of posting a self-answered question, it would be tidier (and polite) to upvote the Q&A where you found the solution or to post a new answer there if you feel you have something productive to add 😊 – Peter Vandivier May 16 '19 at 9:40
  • I was in doubt about this one. It is subtly different, since sudo is involved, so it could be argued to be a different question. But in any case it was not my intention to be impolite, will definitely keep your remarks in mind! – Thijs May 20 '19 at 9:45
1

Found the answer in another post on stackexchange.

I've edited the authentication lines in pg_hba.conf and changed "trust" into "password" for all lines. It now looks like this:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

local   all             all                                     password
host    all             all             127.0.0.1/32            password
host    all             all             ::1/128                 password
local   replication     all                                     password
host    replication     all             127.0.0.1/32            password
host    replication     all             ::1/128                 password

Now psql asks me for a password every time.

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.