Ticket #735 (closed bug: invalid)

Opened 7 years ago

Last modified 5 years ago

can't connect to postgres without password

Reported by: msieczka Owned by: nobody
Priority: major: does not work as expected Milestone:
Component: SPIT Version: 0.8.1
Keywords: Cc:
Platform Version: Ubuntu Dapper Platform: Debian
Must Fix for Release: Yes Awaiting user input: no

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

Change History

  Changed 7 years ago by leonardomateo

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.

  Changed 7 years ago by msieczka

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.

follow-up: ↓ 4   Changed 7 years ago by gsherman

  • status changed from new to closed
  • resolution set to invalid

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.

in reply to: ↑ 3   Changed 7 years ago by msieczka

Replying to 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

  Changed 5 years ago by anonymous

  • milestone Version 0.8.2 deleted

Milestone Version 0.8.2 deleted

Note: See TracTickets for help on using tickets.