WestCoastProjects
WestCoastProjects

Reputation: 63221

.pgpass is working for one user but not the postgres user

There are .pgpass entries to an rds/postgres database on my laptop:

15.207.x.y:1234:clip:clip:whatever1
15.207.x.y:1234:postgres:clip:whatever2

The first one for clip user is working. The second for postgres user is not. I have run

psql -p 1234 -h $RDSI -U clip -d clip

and it works without password. Instead

psql -p 1234 -h $RDSI -U postgres -d clip

requires/prompts for the password. When I put the password (nominally whatever2) it does connect.

What is different between the two to cause the difference in behavior? The db owner is clip but that should not affect this process .. ?

Upvotes: 0

Views: 60

Answers (1)

AdamKG
AdamKG

Reputation: 14091

You have user and database swapped. Your 2nd line should be 15.207.x.y:1234:clip:postgres:whatever2 for user postgres. Per the docs, the format is hostname:port:database:username:password.

Upvotes: 2

Related Questions