1

On my dying Ubuntu 18.04 system I was able to retrieve the crewdb_bak.tar file (PostgreSQL backup file) and save it to a USB. The file was created with the following command:

pg_dump -U postgres -h localhost -W -F t crewdb > /home/chris1/Documents/crewcut/crewdb/crewdb_bak.tar

On a new Ubuntu system after I installed PostgreSQL I ran the following command in the terminal to restore the database:

psql -U postgres -d crewdb < /media/chh1/1818-305D/crewdb_bak.tar

Unfortunately I get the following output:

psql: FATAL: Peer authentication failed for user "postgres"

pg_dump -U postgres -h localhost -W -F t crewdb > /home/chris1/Documents/crewcut/crewdb/crewdb_bak.tar

psql -U postgres -d crewdb < /media/chh1/1818-305D/crewdb_bak.tar

Community
  • 1
  • 1
Christian Hick
  • 401
  • 3
  • 10

1 Answers1

0

You may find this other question helpful: Getting error: Peer authentication failed for user "postgres", when trying to get pgsql working with rails

In particular, the accepted answer suggests editing your pg_hba.conf file and checking the settings for the postgres user. The error you are seeing indicates that it is set to peer.

You can have a look at the authentication documentation for postgres, which may help you determine which type is best for your use.

If you still have access to the dying system, maybe see what it has set up?

Nick
  • 1,265
  • 12
  • 15
  • thanks Nick for your answer. I edited the pg_hba.conf file according to your suggestions and am able to get past the error message. My problem now is that the database structure (table and views) has restored correctly, however there is no data in the tables. Any ideas on that? – Christian Hick Jul 27 '19 at 05:28