Sigularity
Sigularity

Reputation: 967

No password prompt in PostgreSQL connection

I wonder why no password prompt in my login try below. I know if I use md5 option in pg_hba.conf file but I want to check if I can log in without any password with trust enabled.

No setting PGPASSWORD environment variable.

No %APPDATA%\postgresql\.pgpass file / Nowhere

psql -U testuser -p 5433 -d postgres
psql (9.5.0)
WARNING: Console code page (1252) differs from Windows code page (949)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.

postgres=>
postgres=>


pg_hba.conf

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
host    all             all             0.0.0.0/0            trust
host    all             all             all        trust

Upvotes: 2

Views: 1238

Answers (1)

Jasen
Jasen

Reputation: 12392

This line says IP4 connections IPv4 localhost need no authentication

host    all             all             127.0.0.1/32            trust

This line says all other ip4 connections need no authenticaton

host    all             all             0.0.0.0/0            trust

And this line says all TCP connections (including ipv6) need no authentication

host    all             all             all        trust

So it's probably the third line allowing connections from ::1 without authentication that causes there to be no password prompt.

Upvotes: 1

Related Questions