Is password-less authentication supported for postgresql?

Completed

Basically the subject line says it all. Things are configured in our django project such that the current user has access to the database without using a password. I'd like to be able to configure the datasource in pycharm because I'm curious about this feature of the IDE.

6 comments
Comment actions Permalink

I had the same problem and i had to comment a rule above the newly added one.

 

host all all 127.0.0.1/32 md5

 

Since it overruled my newly added one.

Thanks for sharing your solution Nhomar. :)

1
Comment actions Permalink

Yes, it's supported. Please try it and let us know if you have any problems with it.

0
Comment actions Permalink

I tried it out before posting, and kept getting a password prompt. I tried using hte url-based setting, for example.

0
Comment actions Permalink

Do you create a Data Source for connection in IDE? It should work fine with just an empty password (provided that no password is configured for the user). Otherwise, IDE answers to the database prompt for a password. So if it happens it loos like some connection parameters are not right. 

Make sure you are specifying all correct parameters: database host, port, user name and the database name.

0
Comment actions Permalink

Sadly it did not work at my end neither.

 

:-(

0
Comment actions Permalink

Hello.

Finallyyyyyyyy!

As I know I will forget the reason and the solution I will share here such solution.

Concept:

  1. jdbc uses TCP/IP
  2. psql uses Socket if not -h passed.

Then if you will connect from pycham you must add a line as this to your pg_hba.conf. (Edit the one that exists) and then retart postgresql.

host    all    all   127.0.0.1/32    trust

Which means: Trust with the same policy from all users from a local machine connection to see postgresql by TCP/IP.

This is unsecure in a server, if you want to be more precise (maybe in a shared machine) you should add your user:

host    all    youruser   127.0.0.1/32    trust

Ugly and unsecure, but it solved the conflict of connect without password.

Note: For psql it is peer (local unix autenticated user).

Remember if you are with an user youruser you must createuseer youruser as postgresql also because the user must exits in both namespaces Linux and Postgresql.

I read this thread in stackoverflow tens of times and did not find the relation, but one of the comments was actually the solution

0

Please sign in to leave a comment.