I am facing an issue even after following all the steps as suggested in the answer provided by Neil Mcguigan for the question asked In the above link

I was getting an error - "psql: f_sendauth no password supplied." When I tried to run a psql command from CMD in Windows server.

I have created pgpass.conf and placed in the path - *C:\users\myname\AppData\Roaming\postgresql*

I have set the environment variable PGPASSFILE and given the above path.

The command I am using looks like this.

psql -w -c "my command to export data from a table in postgre database and save it in a CSV in shared folder" --host myhostname ----dbname mydbname --username my username

-w command in postgre should ideally stop from prompting for a password.

What am I missing..!? Please help

  • You created pgpass.conf, but what did you put in it? If you put it in the default place (which it looks like you did) then you don't need to set PGPASSFILE at all. But since you did set it, what did you set it to? It needs to be the complete file name, not just the directory name.
    – jjanes
    Commented May 28, 2021 at 14:35
  • -w does indeed stop it from prompting for a password. Which is why you get the f_sendauth error, rather than a password prompt.
    – jjanes
    Commented May 28, 2021 at 14:37
  • Hi @jjanes, I have placed the pgpass.conf(which contains (the host:port:dbname:username:password) file in two locations one under C:\windows/system32/config/systemprofile/Appears/Roaming/postgresql/pgpass.conf, the other one under my user folder C:\users\myname\AppData\Roaming\postgresql.
    – Ohmi i
    Commented Jun 4, 2021 at 11:33


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.