I have an environment variable PGPASSFILE
declared pointing to the location of my .pgpass
file.
>echo $PGPASSFILE
/somedir/.pgpass
As per this doc, the permission stamp of the file is proper to not expose the file to anyone else:
>ls -la /somedir
drwxr-xr-x 2 root root 4096 2014-06-25 17:40 .
drwxr-xr-x 6 root root 4096 2014-06-25 16:37 ..
-rw------- 1 root root 354 2014-06-25 16:43 .pgpass
-rw-r--r-- 1 root root 30 2014-06-25 16:37 .pgpass_path
The file looks about right:
1 localhost:*:*:postgres:blabla
2 localhost:*:somedb:somedb_master:blabla
3 localhost:*:somedb:somedb_rw:blabla
However, when I try to invoke psql, it still prompts me for password:
>psql -h localhost -d somedb -U somedb_rw
Password for user somedb_rw:
The connection succeeds when I enter password but I shouldn't be prompted. Any idea what may be wrong? This is on Ubuntu 10.04 VM. On my Mac host, this same configuration works without prompting.
/somedir/.pgpass
, but then you do als -la /somedir/.pgpass
and it shows a file owned by root with the same name. – Favourable