1

I am trying to create a user mapping in PostgreSQL without a password, but I am encountering an error that says.

local_db=> select * from employee;
ERROR:  could not connect to server "testmachine02"
DETAIL:  connection to server at "192.168.56.10", port 5432 failed: fe_sendauth: no password supplied

Here is the command that I used to create the user mapping:

CREATE USER MAPPING for app_user SERVER testmachine02 OPTIONS (password_required 'false');

I also created a pgpass file under /root/.pgpass with the following entries:

localhost:5432:local_db:app_user:app_user123
192.168.56.10:5432:admin:admin:admin123
192.168.56.10:5432:remote_db:test:test123

Despite these steps, I am still unable to access the table without a password. How can I create a user mapping without a password and access the table?

1 Answer 1

1

The mistake is that you created the password file in root's home directory. It must be in the home directory of the user that owns the database server processes, probably postgres.

Make sure you set the ownership and permissions on the file as described by the documentation.

0

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.