I have a postgres server running in a docker container. I added a user there named "myuser". I also have a linux user named "myuser".

Then (as root) I do:

$ su - myser
$ psql
Password for myuser:

My question is, why does it ask me for a password? When I ran the postgres server installed on the host (not in a docker container) it was enough that the usernames matched and I could log in without a password.

How can I log in to the psql server without supplying a password?

  • 1
    It has to do with the configuration in the file pg_hba.conf that has to be different between your distribution and the Docker container. You can find more info on postgresql.org/docs/current/auth-pg-hba-conf.html You should add the content of that file to your question to get a more precise answer. Aug 10, 2022 at 13:30


You must log in to answer this question.

Browse other questions tagged .