Opened 17 years ago

Closed 17 years ago

Last modified 15 years ago

#735 closed bug (invalid)

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:
Must Fix for Release: Yes Platform: Debian
Platform Version: Ubuntu Dapper Awaiting user input: no


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.


postgresql 8.1.9, postgis 1.2.1, QGIS 0.8.2 + SVN 7052

Change History (5)

comment:1 by leonardomateo, 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.

comment:2 by msieczka, 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.

comment:3 by gsherman, 17 years ago

Resolution: invalid
Status: newclosed

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      trust

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

in reply to:  3 comment:4 by msieczka, 17 years ago

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.


comment:5 by (none), 15 years ago

Milestone: Version 0.8.2

Milestone Version 0.8.2 deleted

Note: See TracTickets for help on using tickets.