Using the following command:

% pg_dump -h postgres.cs.host.ca -p 5433 -n _cscf_subscription -Fc -f ~/old.dump odyssey_prod
pg_dump: [archiver (db)] connection to database "cs-rsub" failed: FATAL:  password authentication failed for user "cs-rsub"
FATAL:  password authentication failed for user "cs-rsub"

Yet psql works fine:

% psql -U _cscf_subscription -d odyssey_prod -h postgres.cs.host.ca -p 5433
psql (9.3.4, server 9.2.4)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

postgres=> \q

It is odd that pg_dump does not simply use the .pgpass file like psql does, however even pasting and manually typing in the password that is stored in the .pgpass file into the pg_dump password prompt still fails to authenticate. I an using the same account, same role, and same host.

What could be going wrong here?

In case the versions matter at all:

SELECT version(); executed via the working psql returns:

PostgreSQL 9.2.4 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit

And pg_dump --version is:

pg_dump (PostgreSQL) 9.3.4

I doubt this would matter but psql --version is:

psql (PostgreSQL) 9.3.4

Any ideas to what is going wrong?

closed as off-topic by Jenny D, mdpc, MadHatter, TheCleaner, MichelZ Aug 13 '14 at 18:46

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Jenny D, MadHatter, TheCleaner, MichelZ
If this question can be reworded to fit the rules in the help center, please edit the question.


You are not "using the same account, same role, and same host", not even close.

In your pg_dump call you don't supply any username (-U) or database (-d), only a hostname (-h) and schema (-n). So pg_dump uses your system user as a DB username and database to connect to. Judging by the error message, your system user seems to be "cs-rsub".

In the psql call you supply both a username (-U) and a database (-d) and neither is "cs-rsub".

Not the answer you're looking for? Browse other questions tagged or ask your own question.