PostgreSQL: Why psql is running without Password?

I have configured one of my PostgreSQL Test Server in windows operating system.

I just open psql command line tool and it opened without asking a any password.

I just surprised, when I logged in psql without any password. This should not happen in any situation.

I was finding a solution of this problem and came to know about pgpass.conf file for Windows OS and .pgpass file for Unix OS.

This file exists on client location and contain information about login authentication.

For windows, you can find this file here: %APPDATA%\postgresql\pgpass.conf

The format of this file:

I have opened this file in windows and found that password written in plain text.
Whenever I open psql, it takes default postgres user password from this file.

I just removed this plain text password from pgpass.conf file and now psql prompts to enter a specific password for login.

Anvesh Patel

Leave a Reply

Be the First to Comment!

Notify of