Bug report #735

can't connect to postgres without password

Added by Maciej Sieczka - almost 17 years ago. Updated over 14 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:-
Affected QGIS version: Regression?:No
Operating System:Debian Easy fix?:No
Pull Request or Patch supplied: Resolution:invalid
Crashes QGIS or corrupts data: Copied to github as #:10794

Description

When I try to connect or test a connection to a PostGIS database as user that has no password I get an error:

fe_sendauth: no password supplied

The user has no password, so QGIS should not demand it.

To workaround this I had to add password for my postgresql user.

Setup:

postgresql 8.1.9, postgis 1.2.1, QGIS 0.8.2 + SVN 7052

History

#1 Updated by leonardomateo - almost 17 years ago

Are you sure is a QGis problem?
Can you connect to PostgreSQL from command line or from PGAdmin without a password?
I have several connections to PostgreSQL servers without a password and the servers are located on localhost and over a LAN. I have configured PostgreSQL server to trust connections from convenient IP's and doesn't require passwords.

#2 Updated by Maciej Sieczka - almost 17 years ago

I'm not using PGAdmin or any other GUI.

But I'm sure when my role doesn't have a password it works from the command line, eg.:

psql --username myname --dbname mydatabse

I'm not prompted for a password and all is OK. For QGIS to my PostgreSQL role to work I have to set a password for it and enter it in QGIS. Otherwise I get the error as mentioned.

The PostgreSQL server and client is localhost.

#3 Updated by Gary Sherman almost 17 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed

This is not a bug. QGIS uses tcp/ip connections to PostgreSQL, regardless of
whether both client and server are on the same host. You can configure
PostgreSQL to accept such connections as trusted, however doing so may be a
security risk depending on your environment.

The reason it works from psql for you is that your user is trusted for local connections using sockets. If you want to allow connections from QGIS without a password you can modify your pg_hba.conf file and add a line similar to this:

host    mydatabase        myuser         127.0.0.1/32      trust

This will allow the user "myuser" trusted access to database "mydatabase" when connecting from QGIS on the localhost.

#4 Updated by Maciej Sieczka - almost 17 years ago

Replying to [comment:3 gsherman]:

This is not a bug. QGIS uses tcp/ip connections to PostgreSQL, regardless of
whether both client and server are on the same host.

Absolutely correct. Thanks Garry and very sorry for the fuss.

Maciek

#5 Updated by Anonymous over 14 years ago

Milestone Version 0.8.2 deleted

Also available in: Atom PDF