Why we can backup postgresql database backup without password?

Posted on

Question :

I want to backup my PostgreSQL database with pg_dump command that takes a lot of parameters.
One of them is --no-password.

Why this parameter is provided?

I mean if anyone can backup database, so what about security?

Answer :

Read documentation on this: “If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail.” This parameter doesn’t mean that you can connect (and dump) without knowing password, it is just help for (backup) scripts where entering passwords isn’t possible by hand.

You cannot dump the database without a password if you’re not allowed to. Check your pg_hba.conf configuration.

Leave a Reply

Your email address will not be published. Required fields are marked *