I have put a .pgpass file in /folder/.pgpass and it looks like this
*:*:*:postgres:password_for_postgres
I have a bash script where I backup the database from postgreSQL:
#!/bin/bash
export PGPASSFILE=/folder/.pgpass
echo $PGPASSFILE
pg_dump --username=postgres --format=c --file=/backup/db/db.sqlc database
However, the script still promts me for the password. PGPASSFILE has the value as it should, as far as I can see. Any hints on what the problem might be?
/K
Best Answer
Is the pgpass file set to mode 0600 (i.e. read/write only by the owner)? The client library will ignore it if it's group- or world-readable.