psql dump database from other user without loginto postgres user
Solution :
Change
local all postgres peer
to
local all postgres trust
Restart postgresql.
$ whoami ubuntu $ pg_dump -U postgres dbname > db.sql FATAL: Peer authentication failed for user "postgres"
Solution :
sudo nano /etc/postgresql/9.4/main/pg_hba.conf
Change
local all postgres peer
to
local all postgres trust
Restart postgresql.