Opened 10 years ago

Closed 10 years ago

Last modified 8 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 Changed 10 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.

comment:2 Changed 10 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.

comment:3 Changed 10 years ago by gsherman

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.

comment:4 in reply to:  3 Changed 10 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.


comment:5 Changed 8 years ago by (none)

Milestone: Version 0.8.2

Milestone Version 0.8.2 deleted

Note: See TracTickets for help on using tickets.